简体   繁体   English

Maven版本和java版本冲突

[英]Maven version and java version conflict

I can only use java 1.6 for my project.我的项目只能使用 java 1.6。 So maven version also has to be 2.2.1 .所以 maven 版本也必须是 2.2.1 。 Cannot use maven 3.0.无法使用 Maven 3.0。 But while building I'm getting following error :但是在构建时出现以下错误:

 Error resolving version for 'org.apache.maven.plugins:maven-jar-plugin':Plugin requires Maven version 3.0

this is the pom:这是pom:

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
</plugin>

what are the version that we can use?我们可以使用什么版本?

Changes the source and target to 1.6.将源和目标更改为 1.6。 If your code does not make use of java8 features then it should work just fine.如果您的代码没有使用 java8 功能,那么它应该可以正常工作。 This will generate a jar that is compatible with any java6 codebase.这将生成一个与任何 java6 代码库兼容的 jar。

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
</plugin>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM