jenkins 用 Maven 打包出现 找不到符号 问题的解决方法
来源:互联网 发布:在线音乐软件 编辑:程序博客网 时间:2024/06/06 09:15
1 发现问题
今天用 持续集成工具 jenkins 打包一个新项目,出现了很多错误:
...[ERROR] [ERROR] \ideaProjects\xxx\ProjectService.java:[201,73] 错误: 找不到符号[ERROR] [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/MojoFailureExceptionProcess finished with exit code 1
用 idea 中的 Maven 工具直接打包也是报这个错误,在 maven 命令行中加入compile -e -X
后,可以看到详细的出错日志:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project supervise: Compilation failure at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) at org.codehaus.classworlds.Launcher.main(Launcher.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:656) at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) ... 26 more[ERROR] [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
2 寻找原因
奇怪的是,如果事先在 idea 中用 tomcat 运行过后一次以后,就可以顺利编译了。但持续集成工具只能使用 maven 的 compiler 工具直接编译。
发现 maven-compiler-plugin 2.x 使用的是 javac 编译,而 maven-compiler-plugin 3.x 就改用 javax.tools.JavaCompiler(jdk 6 以上,我们用的是 jdk 7) 了,这么看,估计是 javac 的问题了。
3 解决
把 maven-compiler-plugin 改为 3.x 版本,编译成功!O(∩_∩)O ~
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <!--<version>2.3.1</version>--> <version>3.6.1</version> <configuration> <source>1.7</source> <target>1.7</target> <encoding>utf8</encoding> </configuration></plugin>
0 0
- jenkins 用 Maven 打包出现 找不到符号 问题的解决方法
- Jenkins Maven打包出错异常的解决方法
- 解决Maven编译(maven install)时,出现的“找不到符号”的问题
- 解决Maven编译(maven install)时,出现的“找不到符号”的问题
- jenkins maven编译打包找不到依赖库的解决办法
- MAVEN 编译打包时报“.....找不到符号” 的处理方法总结
- 在 Jenkins 中,使用 maven 打包报 package xxx does not exist 问题的解决方法
- IDEA Maven打包时报找不到符号错误
- 运行maven install 出现错误: 找不到符号
- Mybatis使用maven打包出现的问题
- maven编译打包时出现的问题
- 解决maven多工程项目'找不到符号'问题
- maven install,compile,或者打包的时候 找不到符号,类 错误
- maven install,compile,或者打包的时候 找不到符号,类 错误
- jenkins maven 本地jar包 打包问题
- 使用Maven打包出现问题
- 项目利用Maven Install指令构建时出现找不到符号
- Jenkins部署Maven项目时提示找不到JDK问题的解决方案
- 1130. Infix Expression (25)
- 八大排序算法
- Redis Sentinel实现的机制与原理详解
- ArrayList、LinkedList、Vector的区别
- 活动安排
- jenkins 用 Maven 打包出现 找不到符号 问题的解决方法
- Lnmp环境下搭建SVN
- 【Unity优化】构建一个拒绝GC的Lis
- Linux五种IO模型
- 解决基于Qt5.1.1遇见QWebView 找不到,以及网页加载不出来.
- Naor & Shamir 的单秘密视觉共享方案
- bootStrap table动态刷新数据
- Git命令行操作对本地代码提交看着一篇就够了。
- 安卓开发笔记(一)