简体   繁体   English

无法在 jenkins 中构建 groovy jar

[英]Unable to build a groovy jar in jenkins

I am unable to build a jar in jenkins slave/master.我无法在 jenkins 从/主中构建 jar。 tried different approach, however unable to resolve this below issue.尝试了不同的方法,但无法解决以下问题。 The same command is helping in locally and am able to create the jar.相同的命令在本地提供帮助,并且能够创建 jar。

export PATH=/opt/apache-maven-3.6.3/bin:$PATH
mvn clean compile -f /home/iburahim/workspace/automation/ -pl testproject -am assembly:single

Errors:错误:

    10:03:29 WARNING: An illegal reflective access operation has occurred
    10:03:29 WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/root/.m2/repository/org/codehaus/groovy/groovy-eclipse-batch/2.4.3-01/groovy-eclipse-batch-2.4.3-01.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
    10:03:29 WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
    10:03:29 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    10:03:29 WARNING: All illegal access operations will be denied in a future release
    10:03:32 /home/iburahim/workspace/automation/base/src/main/groovy/com/comapny/base/config/Config.groovy: 34 Groovy:unable to resolve class Map
    10:04:01 [ERROR] /home/iburahim/workspace/automation/base/src/main/groovy/com/company/base/sdk/connector/ExternalFilterConnector.java:[89,136] 9344. ERROR in /home/iburahim/workspace/automation/base/src/main/groovy/com/company/base/sdk/connector/ExternalFilterConnector.java (at line 89)
    10:04:01 [ERROR]    AdroitRESTDriver driver = new AdroitRESTDriver(myConfig.getConnectorByType("AdroitServer1").getConfigParam("applianceAdmin"), myConfig.getConnectorByType("AdroitServer1").getConfigParam("applianceAdminPassword"));
    10:04:01 [ERROR]                                                                                                                                           ^^^^^^^^^^^^^^^^^^
    10:04:01 [ERROR] The method getConnectorByType(String) from the type MyConfig refers to the missing type String

Maven, groovy3+, java installed in the slave machine (OpenSuse42). Maven,groovy3+,java安装在从机(OpenSuse42)。 Please do help on this.请在这方面提供帮助。

Finally I found an answer.最后我找到了答案。 Issue because of local cli and Jenkins using different java version from slave machine.由于本地 cli 和 Jenkins 使用来自从机的不同 java 版本而出现问题。 When i was checking java version in Slave CLI当我在 Slave CLI 中检查 java 版本时

openjdk version "1.8.0_212" OpenJDK Runtime Environment (IcedTea 3.12.0) (build 1.8.0_212-b4 suse-34.1-x86_64) OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode) openjdk 版本 "1.8.0_212" OpenJDK 运行时环境 (IcedTea 3.12.0) (build 1.8.0_212-b4 suse-34.1-x86_64) OpenJDK 64-Bit Server VM (build 25.212-b04, 混合模式)

When i was checking the slave machine java version through jenkins, its returning当我通过jenkins检查从机java版本时,它返回

19:09:28 + java -version 19:09:29 java version "9.0.4" 19:09:29 Java(TM) SE Runtime Environment (build 9.0.4+11) 19:09:29 Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode) 19:09:28 + java -version 19:09:29 java version "9.0.4" 19:09:29 Java(TM) SE Runtime Environment (build 9.0.4+11) 19:09:29 Java HotSpot(TM ) 64 位服务器 VM(内部版本 9.0.4+11,混合模式)

Then I found the mismatch and corrected in jenkins slave configuration,然后我在 jenkins 从配置中发现了不匹配并更正了,

Just added the java home path as /usr/lib64/jvm/jre and ran the job.只需将 java 主路径添加为 /usr/lib64/jvm/jre 并运行该作业。 jar successfully created. jar 创建成功。 I hope this info helpful to someone.我希望这些信息对某人有所帮助。

enter image description here在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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