简体   繁体   中英

COMPILATION ERROR : Failed to execute maven-compiler-plugin:2.3.2:compile

i tried build on jenkins simple project with maven, but i getting this error and i don't inderstand what's the issue

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: 

[1]:https://i.stack.imgur.com/p3Whu.png

You can solve it in 3 ways

  1. Upgrade to JDK7 or JDK8 (meh)
  2. Use maven-compiler-plugin version or later, because
  3. Indicate to the maven-compiler-plugin to use source level 7 and target 7
<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
    </plugin> 

or

<properties>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
  </properties>

As the error clearly states maven-compiler-plugin should be configured with java 7 or higher version.

<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>

Also update maven-compiler-plugin as 2.3.2 is really old. check this for further explanation Maven Compilation Error: (use -source 7 or higher to enable diamond operator)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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