Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven build error #181

Open
uncle-norman opened this issue Sep 4, 2021 · 2 comments
Open

Maven build error #181

uncle-norman opened this issue Sep 4, 2021 · 2 comments

Comments

@uncle-norman
Copy link

Hi James,

I'm on your Udemy Jenkins lecture.

I encountered the following error while building the first Jenkins project. Would you please kindly advise the next steps? Thank you!

[INFO] -------------------------------------------------------------
[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.
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Maven Project 1.0-SNAPSHOT:
[INFO]
[INFO] Maven Project ...................................... SUCCESS [ 0.142 s]
[INFO] Server ............................................. FAILURE [ 0.402 s]
[INFO] Webapp ............................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.630 s
[INFO] Finished at: 2021-09-04T09:59:06+08:00
[INFO] ------------------------------------------------------------------------
[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:
[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] -> [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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :server
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE

@jpa1911
Copy link

jpa1911 commented Sep 14, 2022

I had the same problem and still did not get a solution. Did you get any?

@Vishal31122000
Copy link

The issue is related to the compilation failure due to source and target compatibility levels. However, in the webapp.xml provided, there is no Maven Compiler Plugin configuration similar to the server-side pom.xml.

FIXED the compilation issue, we can add the Maven Compiler Plugin configuration to the webapp module's pom.xml.

4.0.0

com.example.maven-project maven-project 1.0-SNAPSHOT ../pom.xml

webapp
war
Webapp
Webapp.

${project.artifactId}
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.1</version>
    <configuration>
      <source>7</source> <!-- Update the source compatibility level -->
      <target>7</target> <!-- Update the target compatibility level -->
    </configuration>
  </plugin>
  <plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
  </plugin>
</plugins>
javax.servlet servlet-api provided javax.servlet.jsp jsp-api provided

Ensure that we replace 7 with the appropriate source and target compatibility levels we want to use. After updating the pom.xml, save the changes and rebuild your project in Jenkins. This should resolve the source and target compatibility level errors for the webapp module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants