Java 警告请求的配置文件“pom.xml”无法激活,因为它不存在
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25232541/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WARNING The requested profile "pom.xml" could not be activated because it does not exist
提问by topcan5
I am trying to run maven goal: validation and keep getting: [WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
我正在尝试运行 maven 目标:验证并继续获取:[警告] 无法激活请求的配置文件“pom.xml”,因为它不存在。
In my org.eclipse.m2e.core.prefs:
在我的 org.eclipse.m2e.core.prefs 中:
activeProfiles=pom.xml
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
What did I do wrong?
我做错了什么?
回答by Martin Seeler
Your activeProfiles
is set to pom.xml
. But your Maven profile should be defined insideyour pom.xml
with an id
. You have to set this id as the active profile or remove this line to use the default profile of your maven project.
您activeProfiles
的设置为pom.xml
. 但是您的 Maven 配置文件应该在您的内部pom.xml
使用id
. 您必须将此 ID 设置为活动配置文件或删除此行以使用 Maven 项目的默认配置文件。
回答by Simon
- Right click on your project
- Go to "Run as"
- Go to "Run configurations... "
- When the screen opens, please delete the word "pom.xml" from the "Profiles:" line and then click "Run".
- 右键单击您的项目
- 转到“运行方式”
- 转到“运行配置...”
- 当屏幕打开时,请从“配置文件:”行中删除“pom.xml”一词,然后单击“运行”。
The project will now run.
该项目现在将运行。
回答by Yambi
You just have to:
你只需要:
- delete .m2 repository.
- execute mvn clean install.
- 删除 .m2 存储库。
- 执行 mvn 全新安装。
That solved my problem
那解决了我的问题
回答by Reenactor Rob
In the Eclipse IDE, you can find the profile ID listed in two places. The two apparently aren't kept in the same place as I found the profile listed in one place and not the other.
在 Eclipse IDE 中,您可以找到在两个地方列出的配置文件 ID。这两个显然没有保存在同一个地方,因为我发现在一个地方而不是另一个地方列出了个人资料。
Project-> Run As -> Run Configurations -> Maven Build
项目-> 运行方式-> 运行配置-> Maven 构建
If your project is not listed here, then there is no maven profile set. Before making any changes, make sure the name at the top of the right hand window reads your project name! The main tab has a box labeled Profiles:
如果此处未列出您的项目,则说明未设置 Maven 配置文件。在进行任何更改之前,请确保右侧窗口顶部的名称为您的项目名称!主选项卡有一个标记为 Profiles 的框:
Project->Properties->Maven
项目->属性->Maven
Active Maven Profiles appear in the right hand pane. Simple delete and click apply. This cleared my problem.
Active Maven Profiles 出现在右侧窗格中。简单删除,然后单击应用。这解决了我的问题。
回答by Khachornchit Songsaen
- Right click on the project
- Select menu Properties
- Click on Mavenitem in the list of left side
- Look at the right side and removing pom.xmlfrom the box
- Apply & Close
- 右键单击项目
- 选择菜单属性
- 单击左侧列表中的Maven项目
- 查看右侧并从框中删除pom.xml
- 申请并关闭
回答by Aashutosh Taikar
Right click on the project:
右键单击项目:
- maven -> disable maven nature
- configure -> Convert to maven project
- run As -> Maven clean
- run As -> Maven install
- maven -> 禁用 maven 特性
- 配置 -> 转换为 Maven 项目
- 运行方式 -> Maven clean
- 运行方式 -> Maven 安装
回答by Shekhar Sahu
Check the target Java version matches the installed Java version in the pom.xml
. Even if you have the java version installed. Check if eclipse project facet has correct java version.
检查目标 Java 版本是否与pom.xml
. 即使您安装了java版本。检查 eclipse 项目方面是否有正确的 java 版本。
<properties>
<java.version>1.8</java.version>
</properties>