gpt4 book ai didi

maven - JDK7,mvn-3.2.2 - maven-enforcer-plugin - RequireJavaVersion 失败

转载 作者:行者123 更新时间:2023-12-02 04:28:59 26 4
gpt4 key购买 nike

我正在使用 JDK 1.7.0_60maven-3.2.2。当我在项目 new-project 上运行 mvn clean install 时,出现以下错误 -

[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ new-project ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (default) @ new-project ---
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
Detected JDK Version: 1.7.0-60 is not in the allowed range [1.5,1.6,1.7.0-60).
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.621 s
[INFO] Finished at: 2014-07-10T20:37:32+05:30
[INFO] Final Memory: 7M/18M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce (default) on project new-project: Some Enforcer rules have failed.
Look above for specific messages explaining why the rule failed. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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

以下是我的 pom.xml 的部分内容,因为我无法分享完整的内容-

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<showDeprecation>true</showDeprecation>
<source>1.7.0-60</source>
<target>1.7.0-60</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<classpathContainers>
<classpathContainer>
org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5
</classpathContainer>
</classpathContainers>
<additionalConfig>
<file>
<name>
.settings/org.eclipse.core.resources.prefs
</name>
<content>
eclipse.preferences.version=1${line.separator}encoding/&lt;project&gt;=UTF-8${line.separator}
</content>
</file>
</additionalConfig>
<downloadSources>true</downloadSources>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<configuration>
<rules>
<requireJavaVersion>
<version>[1.5,1.6,1.7.0-60)</version>
</requireJavaVersion>
<requireMavenVersion>
<version>[3.2.2,)</version>
</requireMavenVersion>
</rules>
</configuration>
<executions>
<execution>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<sourcepath>
${project.basedir}/src/main/javadoc;${project.basedir}/src/main/java
</sourcepath>
<charset>UTF-8</charset>
<docencoding>UTF-8</docencoding>
<docfilessubdirs>true</docfilessubdirs>
<links>
<link>
http://docs.oracle.com/javase/7/docs/api/
</link>
</links>
<source>1.7.0-60</source>
<show>protected</show>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
</reportSets>
</plugin>

最佳答案

如果您想将版本 1.7.0-30 包含在已接受的 range 中,那么在声明范围时必须使用方括号。您可以省略版本 1.6,因为它包含在该范围内:

<requireJavaVersion>
<version>[1.5,1.7.0-60]</version>
</requireJavaVersion>

关于maven - JDK7,mvn-3.2.2 - maven-enforcer-plugin - RequireJavaVersion 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24680585/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com