英文:
Unable to build a groovy jar in jenkins
问题
我无法在Jenkins的从节点/主节点中构建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
错误信息:
10:03:28 [INFO] 使用Groovy-Eclipse编译器编译Java和Groovy文件
10:03:29 警告:发生了非法的反射访问操作
10:03:29 警告:非法的反射访问来源于org.codehaus.groovy.vmplugin.v7.Java7$1(文件:/root/.m2/repository/org/codehaus/groovy/groovy-eclipse-batch/2.4.3-01/groovy-eclipse-batch-2.4.3-01.jar)对constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)的调用
10:03:29 警告:请考虑将此情况报告给org.codehaus.groovy.vmplugin.v7.Java7$1的维护者
10:03:29 警告:使用--illegal-access=warn以启用进一步非法反射访问操作的警告
10:03:29 警告:在未来的版本中,所有非法访问操作将被拒绝
10:03:32 /home/iburahim/workspace/automation/base/src/main/groovy/com/comapny/base/config/Config.groovy: 34 Groovy: 无法解析类Map
10:04:01 [ERROR] /home/iburahim/workspace/automation/base/src/main/groovy/com/company/base/sdk/connector/ExternalFilterConnector.java:[89,136] 9344. 错误在/home/iburahim/workspace/automation/base/src/main/groovy/com/company/base/sdk/connector/ExternalFilterConnector.java(第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] 来自类型MyConfig的方法getConnectorByType(String)引用了缺失的类型String
Maven、Groovy 3+、Java都已在从节点(OpenSuse42)上安装。请对此进行帮助。
英文:
I am unable to build a jar in jenkins slave/master. tried different approach, however unable to resolve this below issue. The same command is helping in locally and am able to create the 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). Please do help on this.
答案1
得分: 1
终于我找到了一个答案。问题是因为本地的命令行界面和Jenkins使用了与从机器不同的Java版本。当我在从机命令行界面中检查Java版本时,
openjdk版本 "1.8.0_212"
OpenJDK Runtime Environment(IcedTea 3.12.0)(构建1.8.0_212-b4 suse-34.1-x86_64)
OpenJDK 64位服务器VM(构建25.212-b04,混合模式)
当我通过Jenkins检查从机器的Java版本时,返回的是
19:09:28 + java -version
19:09:29 java版本 "9.0.4"
19:09:29 Java(TM) SE Runtime Environment(构建9.0.4+11)
19:09:29 Java HotSpot(TM) 64位服务器VM(构建9.0.4+11,混合模式)
然后我找到了不匹配之处,并在Jenkins从机配置中进行了更正,
只需添加Java主目录路径为 /usr/lib64/jvm/jre 并运行作业。jar成功创建。我希望这些信息对某人有帮助。
英文:
Finally I found an answer. Issue because of local cli and Jenkins using different java version from slave machine. When i was checking java version in Slave CLI
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)
When i was checking the slave machine java version through jenkins, its returning
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)
Then I found the mismatch and corrected in jenkins slave configuration,
Just added the java home path as /usr/lib64/jvm/jre and ran the job. jar successfully created. I hope this info helpful to someone.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论