lyhuo
薄荷加冰丶
2019-12-31 17:17
采纳率: 80%
浏览 517
已采纳

Jenkins打包项目报错,JDK1.8

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.400 s
[INFO] Finished at: 2019-12-31T17:08:37+08:00
[INFO] Final Memory: 32M/117M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project cmdbunion_eureka: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile failed: A required class was missing while executing org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile: org/codehaus/plexus/compiler/util/scan/InclusionScanException
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-compiler-plugin:3.8.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/DATA/repo/repository/org/apache/maven/plugins/maven-compiler-plugin/3.8.1/maven-compiler-plugin-3.8.1.jar
[ERROR] urls[1] = file:/DATA/repo/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[JENKINS] Archiving /DATA/var/lib/jenkins/workspace/cmdbunion_parent/cmdbunion_eureka/pom.xml to com.travelsky/cmdbunion_eureka/0.0.1-SNAPSHOT/cmdbunion_eureka-0.0.1-SNAPSHOT.pom
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: org.codehaus.plexus.compiler.util.scan.InclusionScanException
[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.
[JENKINS] Archiving /DATA/var/lib/jenkins/workspace/cmdbunion_parent/cmdbunion_titsm/pom.xml to com.travelsky/cmdbunion_titsm/0.0.1-SNAPSHOT/cmdbunion_titsm-0.0.1-SNAPSHOT.pom
[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/PluginContainerException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :cmdbunion_eureka

图片说明

图片说明

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • cbtpro
    程序员的救赎 2019-12-31 19:58
    已采纳

    你需要在jenkins的运行build的命令配置里增加-X参数,就像下面,来获取更多的报错信息,其他信息看不到。

    clean install package -x -Dmaven.test.skip=true -Pprod
    

    我从错误信息里看到了缺少class

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project cmdbunion_eureka: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile failed: A required class was missing while executing org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile: org/codehaus/plexus/compiler/util/scan/InclusionScanException
    

    有可能是这两个文件损坏了

    [ERROR] urls[0] = file:/DATA/repo/repository/org/apache/maven/plugins/maven-compiler-plugin/3.8.1/maven-compiler-plugin-3.8.1.jar
    [ERROR] urls[1] = file:/DATA/repo/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
    

    建议你把jenkins服务的目录/DATA/repo/repository/下的关于/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jarorg/apache/maven/plugins/maven-compiler-plugin/3.8.1/maven-compiler-plugin-3.8.1.jar删除掉,重新执行jenkins任务,它会重新下载新的依赖。

    但是更多信息应该给mvn参数加上-x打开调试信息

    另外你设置了两个jdk,可能还跟你的mvn获取的jdk版本有关,查看你写代码时的jdk版本是不是跟maven给出的日志里的jdk版本是兼容的。

    点赞 评论
  • it_zhangwei
    路漫漫兮其修远兮 2020-01-01 13:46

    不是jdk的问题,看起来像是maven插件的问题,前提确定你的项目的确没问题。
    建议你把服务器上的maven仓库里的插件删除后,重新拉取一份maven的maven.compiler.plugin插件。
    或者换一个版本的插件,比如我用的3.6.1版本

    <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
            </configuration>
            <version>3.6.1</version>
    </plugin>
    
    
    点赞 评论

相关推荐