Spring Maven 清理错误 - 请求的配置文件 "pom.xml" 无法激活,因为它不存在
Spring Maven clean error - The requested profile "pom.xml" could not be activated because it does not exist
我正在尝试使用 Maven 构建一个 Spring-Boot *.war,但我不断收到:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.600 s
[INFO] Finished at: 2015-01-28T10:46:11-03:00
[INFO] Final Memory: 6M/123M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
mvn:clean 运行 之后。
我不知道为什么,我正在关注 this guide。
我的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.bigriver</groupId>
<artifactId>webconsultas</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>WebConsultas</name>
<description>Sistema de consulta m�dica on the web</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.WebConsultasApplication</start-class>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>runtime</scope>
</dependency>
-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher-compiler-2.1</artifactId>
<version>2.1.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>http://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>http://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
成功后,maven在项目中生成一个target文件夹,里面只有Manifest.mf、pom.properties和pom.xml。
我是使用 maven/spring 的初学者,我还没有找到任何关于它可能是什么的线索。任何帮助将不胜感激。
完整日志:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project webconsultas: Fatal error compiling: invalid target release: 1.8 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project webconsultas: Fatal error compiling
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:796)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.codehaus.plexus.compiler.CompilerException: invalid target release: 1.8
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:191)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:169)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:785)
... 22 more
Caused by: java.lang.IllegalArgumentException: invalid target release: 1.8
at com.sun.tools.javac.main.RecognizedOptions$GrumpyHelper.error(RecognizedOptions.java:88)
at com.sun.tools.javac.main.RecognizedOptions.process(RecognizedOptions.java:359)
at com.sun.tools.javac.api.JavacTool.processOptions(JavacTool.java:242)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:199)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:68)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:115)
... 24 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
警告信息
[WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
意味着您以某种方式将 -P pom.xml
传递给 Maven,这意味着 "there is a profile called pom.xml
; find it and activate it"。检查您的环境和 settings.xml
是否有此标志,并查看各种 XML 文件中的所有 <profile>
元素。
通常,mvn help:effective-pom
也有助于查看真实 POM 的外观。
现在错误意味着您尝试配置 Maven 来构建 Java 8 代码,但您没有使用 Java 8 运行时。解决方案:
- 安装Java8
- 如果安装了 Maven,请确保使用 Java 8。
JAVA_HOME
是你的朋友
- 将
pom.xml
中的 Java 编译器配置为您实际拥有的 Java 版本。
相关:
这个 link 有如何让它工作的解决方案。
从 "Profiles:" 行中删除 "pom.xml",然后单击 "Run"。
我每次做 'maven clean' 时都会收到同样的警告。我找到了解决方案:
Step - 1 Right click on your project in Eclipse
Step - 2 Click Properties
Step - 3 Select Maven in the left hand side list.
Step - 4 You will notice "pom.xml" in the Active Maven Profiles text box on the right hand side. Clear it and click Apply.
下面是屏幕截图:
希望这对您有所帮助。 :)
是的,我也遇到了同样的错误。所以我做了以下更改
-> 在“控制台”选项卡附近的“问题”选项卡中检查错误
-> 查看错误仍然存在的位置,可能是某些 jar 文件已损坏或已过时,因此项目中的 pom 未激活。
-> 我发现我的一个 jar 是过时的版本,所以我通过从这个 link https://mvnrepository.com
的 Maven 存储库获取依赖项来更新它
总而言之,请检查错误持续存在的位置以及哪个 jar 文件已过时并进行相应更改
转到属性 -> maven
从激活配置文件中删除 pom.xml 并按照以下步骤操作。
步骤:
- 删除 .m2 存储库
- 重新启动 Eclipse IDE
- 刷新并重建它
遇到同样的警告。
如果您指定目标并使用“运行 as -> Maven build...”选项构建项目
检查并删除 pom.xml 来自 Profiles: Goals:
有时 java 配置有问题。
具体需要我们提供。
<properties>
<java.version>1.8</java.version>
</properties>
它解决了我的问题。
https://es.whosebug.com/a/455761/230548
将STS版本改为4.10,避免使用4.10之前的版本。例如:使用3.9.8版本就会出现这个问题!
将 STS 版本更新到 4.10 版本,避免使用 4 之前的版本 例如,使用 3.9.8 版本会产生 pom.xml 不存在的错误!
很惊讶这里没有人说要删除安全连接。在许多发行版中,安全连接总是失败。检查您的 pom 配置文件,并删除任何 https,例如:
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- 右键单击您在 STS/Eclipse 中的项目。
- 单击属性。
- 单击左窗格中的 Maven。
- 在右侧的活动 Maven 配置文件文本框中清除 pom.xml。
- 申请并关闭。
尽情享受吧:)
我正在尝试使用 Maven 构建一个 Spring-Boot *.war,但我不断收到:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.600 s
[INFO] Finished at: 2015-01-28T10:46:11-03:00
[INFO] Final Memory: 6M/123M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
mvn:clean 运行 之后。
我不知道为什么,我正在关注 this guide。
我的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.bigriver</groupId>
<artifactId>webconsultas</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>WebConsultas</name>
<description>Sistema de consulta m�dica on the web</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.WebConsultasApplication</start-class>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>runtime</scope>
</dependency>
-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher-compiler-2.1</artifactId>
<version>2.1.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>http://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>http://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
成功后,maven在项目中生成一个target文件夹,里面只有Manifest.mf、pom.properties和pom.xml。
我是使用 maven/spring 的初学者,我还没有找到任何关于它可能是什么的线索。任何帮助将不胜感激。
完整日志:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project webconsultas: Fatal error compiling: invalid target release: 1.8 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project webconsultas: Fatal error compiling
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:796)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.codehaus.plexus.compiler.CompilerException: invalid target release: 1.8
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:191)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:169)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:785)
... 22 more
Caused by: java.lang.IllegalArgumentException: invalid target release: 1.8
at com.sun.tools.javac.main.RecognizedOptions$GrumpyHelper.error(RecognizedOptions.java:88)
at com.sun.tools.javac.main.RecognizedOptions.process(RecognizedOptions.java:359)
at com.sun.tools.javac.api.JavacTool.processOptions(JavacTool.java:242)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:199)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:68)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:115)
... 24 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
警告信息
[WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
意味着您以某种方式将 -P pom.xml
传递给 Maven,这意味着 "there is a profile called pom.xml
; find it and activate it"。检查您的环境和 settings.xml
是否有此标志,并查看各种 XML 文件中的所有 <profile>
元素。
通常,mvn help:effective-pom
也有助于查看真实 POM 的外观。
现在错误意味着您尝试配置 Maven 来构建 Java 8 代码,但您没有使用 Java 8 运行时。解决方案:
- 安装Java8
- 如果安装了 Maven,请确保使用 Java 8。
JAVA_HOME
是你的朋友 - 将
pom.xml
中的 Java 编译器配置为您实际拥有的 Java 版本。
相关:
这个 link 有如何让它工作的解决方案。 从 "Profiles:" 行中删除 "pom.xml",然后单击 "Run"。
我每次做 'maven clean' 时都会收到同样的警告。我找到了解决方案:
Step - 1 Right click on your project in Eclipse
Step - 2 Click Properties
Step - 3 Select Maven in the left hand side list.
Step - 4 You will notice "pom.xml" in the Active Maven Profiles text box on the right hand side. Clear it and click Apply.
下面是屏幕截图:
希望这对您有所帮助。 :)
是的,我也遇到了同样的错误。所以我做了以下更改
-> 在“控制台”选项卡附近的“问题”选项卡中检查错误
-> 查看错误仍然存在的位置,可能是某些 jar 文件已损坏或已过时,因此项目中的 pom 未激活。
-> 我发现我的一个 jar 是过时的版本,所以我通过从这个 link https://mvnrepository.com
的 Maven 存储库获取依赖项来更新它总而言之,请检查错误持续存在的位置以及哪个 jar 文件已过时并进行相应更改
转到属性 -> maven 从激活配置文件中删除 pom.xml 并按照以下步骤操作。
步骤:
- 删除 .m2 存储库
- 重新启动 Eclipse IDE
- 刷新并重建它
遇到同样的警告。 如果您指定目标并使用“运行 as -> Maven build...”选项构建项目 检查并删除 pom.xml 来自 Profiles: Goals:
有时 java 配置有问题。 具体需要我们提供。
<properties>
<java.version>1.8</java.version>
</properties>
它解决了我的问题。
https://es.whosebug.com/a/455761/230548
将STS版本改为4.10,避免使用4.10之前的版本。例如:使用3.9.8版本就会出现这个问题!
将 STS 版本更新到 4.10 版本,避免使用 4 之前的版本 例如,使用 3.9.8 版本会产生 pom.xml 不存在的错误!
很惊讶这里没有人说要删除安全连接。在许多发行版中,安全连接总是失败。检查您的 pom 配置文件,并删除任何 https,例如:
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- 右键单击您在 STS/Eclipse 中的项目。
- 单击属性。
- 单击左窗格中的 Maven。
- 在右侧的活动 Maven 配置文件文本框中清除 pom.xml。
- 申请并关闭。
尽情享受吧:)