我尝试使用maven在jenkins简单项目上构建,但出现此错误,我不理解问题所在
enter code here
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] error: Source option 6 is no longer supported. Use 7 or later.
[ERROR] error: Target option 6 is no longer supported. Use 7 or later.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-
compile) on project server: Compilation failure: Compilation failure:
答案 0 :(得分:1)
您可以通过3种方式解决它
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
或
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
答案 1 :(得分:1)
由于错误明确指出maven-compiler-plugin
应该配置为Java 7或更高版本。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
还更新了maven-compiler-plugin,因为2.3.2确实很旧。检查此内容以获得进一步的解释Maven Compilation Error: (use -source 7 or higher to enable diamond operator)