The project is successful in using maven clean package in the development environment,
Building under jenkins fails.
The main failure log is:
Error org.apache.maven.cli.MavenCli - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project china-great: Compilation failure
Error org.apache.maven.cli.MavenCli - An unknown compilation problem occurred
Error org.apache.maven.cli.MavenCli - -> [Help 1]
Error org.apache.maven.cli.MavenCli -
Error org.apache.maven.cli.MavenCli - To see the full stack trace of the errors, re-run Maven with the -e switch.
Error org.apache.maven.cli.MavenCli - Re-run Maven using the -X switch to enable full debug logging.
Error org.apache.maven.cli.MavenCli -
Error org.apache.maven.cli.MavenCli - For more information about the errors and possible solutions, please read the following articles:
Error org.apache.maven.cli.MavenCli - [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
But these exception logs are actually not very useful.
Fortunately, when I continued to browse the log above, I found a treasure. Officially, this treasure helped me find a solution
Fatal Error: Unable to find package java.lang in classpath or bootclasspath
Then you can see that defined in pom.xml
<compilerArgs>
<arg>
${JAVA_HOME}/jre/lib/rt.jar;${JAVA_HOME}/jre/lib/jce.jar
</arg>
</compilerArgs>
Inside; there is no problem under windows, but there is a problem under linux,
Please refer to:
http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html
Override the char used between path folders. The system-dependent path-separator character. This field is initialized to contain the first character of the value of the system property path.separator. This character is used to separate filenames in a sequence of files given as a path list. On UNIX systems, this character is ':'; on Microsoft Windows systems it is ';'.
User property is: mdep.pathSeparator.
Ok, then we will change ; to ${path.separator}, and the problem will be solved.