警告:无法激活请求的配置文件“项目名称”,因为它不存在

2022-09-02 12:09:53

当我尝试构建我的 maven 项目时,我收到此警告。我已经搜索了谷歌,但没有运气。这真的很烦人,因为我想发布我的项目,但它不适用于此警告(我认为)。构建成功,但是当我尝试部署war文件时,它不起作用(没有错误消息)。当我构建项目时,我能找到的唯一警告是这样的:

[WARNING] The requested profile "projectname" could not be activated because it does not exist.

答案 1

当您的设置中有以下内容.xml(在 .m2 目录中)并且没有 ID 项目名称的配置文件时,会发生这种情况。

<activeProfiles>
  <activeProfile>projectname</activeProfile>
</activeProfiles>

答案 2

您需要使用以下配置文件配置项目 pom.xml:

<profiles>
    <profile>
        <id>**projectid**</id>
    </profile>
</profiles>

推荐