2017-04-22 25 views
8

Nie można uruchomić pomyślnie kompilacji za pomocą Jenkin.Uzyskiwanie wyjątku podczas konfigurowania projektu maven w jenkins

Jenkin Version : 2.46.1 
Maven Version :3.5.0 
Java version : jdk1.7.0_67 

Stworzyłem jeden prosty projekt w języku Java na Maven. Teraz, kiedy integruję to z Jenkinem i klikam teraz na kompilację.
Kompilacja nie powiodła się i wystąpił wyjątek.

java.lang.reflect.InvocationTargetException 

Dołączyłem szczegóły kłody.

Log Szczegóły:

Started by user sougata das Building in workspace C:\Users\sougatadas\workspace\TestNGTutorial Parsing POMs Established TCP socket on 50831 [TestNGTutorial] $ "C:\Program Files\Java\jdk1.7.0_67/bin/java" -cp "C:\Users\sougatadas\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven33-agent-1.8.1.jar;F:\apache-maven-3.5.0-bin\apache-maven-3.5.0\boot\plexus-classworlds-2.5.2.jar;F:\apache-maven-3.5.0-bin\apache-maven-3.5.0/conf/logging" jenkins.maven3.agent.Maven33Main 
    F:\apache-maven-3.5.0-bin\apache-maven-3.5.0 "C:\Users\sougata 
    das\.jenkins\war\WEB-INF\lib\remoting-3.7.jar" "C:\Users\sougata 
    das\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven33-interceptor-1.8.1.jar" 
    "C:\Users\sougata 
    das\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.8.1.jar" 
    50831 <===[JENKINS REMOTING CAPACITY]===>channel started Executing 
    Maven: -B -f C:\Users\sougata das\workspace\TestNGTutorial\pom.xml 
    install java.lang.reflect.InvocationTargetException  at 
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606)  at 
    org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330) 
     at 
    org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238) 
     at jenkins.maven3.agent.Maven33Main.launch(Maven33Main.java:176) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606)  at 
    hudson.maven.Maven3Builder.call(Maven3Builder.java:139)  at 
    hudson.maven.Maven3Builder.call(Maven3Builder.java:70) at 
    hudson.remoting.UserRequest.perform(UserRequest.java:153) at 
    hudson.remoting.UserRequest.perform(UserRequest.java:50) at 
    hudson.remoting.Request$2.run(Request.java:336)  at 
    hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) 
     at java.util.concurrent.FutureTask.run(FutureTask.java:262)  at 
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
     at 
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
     at java.lang.Thread.run(Thread.java:745) Caused by: 
    java.lang.NoSuchFieldError: DEFAULT_USER_SETTINGS_FILE at 
    org.apache.maven.cli.DefaultMavenExecutionRequestBuilder.settings(DefaultMavenExecutionRequestBuilder.java:658) 
     at 
    org.apache.maven.cli.DefaultMavenExecutionRequestBuilder.getMavenExecutionRequest(DefaultMavenExecutionRequestBuilder.java:149) 
     at 
    org.jvnet.hudson.maven3.launcher.Maven33Launcher.getMavenExecutionRequest(Maven33Launcher.java:150) 
     at 
    org.jvnet.hudson.maven3.launcher.Maven33Launcher.main(Maven33Launcher.java:127) 
     ... 21 more ERROR: Failed to parse POMs java.io.IOException: 
    java.lang.reflect.InvocationTargetException  at 
    hudson.maven.Maven3Builder.call(Maven3Builder.java:179)  at 
    hudson.maven.Maven3Builder.call(Maven3Builder.java:70) at 
    hudson.remoting.UserRequest.perform(UserRequest.java:153) at 
    hudson.remoting.UserRequest.perform(UserRequest.java:50) at 
    hudson.remoting.Request$2.run(Request.java:336)  at 
    hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) 
     at java.util.concurrent.FutureTask.run(FutureTask.java:262)  at 
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
     at 
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
     at java.lang.Thread.run(Thread.java:745) at ......remote call to 
    Channel to Maven [C:\Program Files\Java\jdk1.7.0_67/bin/java, -cp, 
    C:\Users\sougata 
    das\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven33-agent-1.8.1.jar;F:\apache-maven-3.5.0-bin\apache-maven-3.5.0\boot\plexus-classworlds-2.5.2.jar;F:\apache-maven-3.5.0-bin\apache-maven-3.5.0/conf/logging, jenkins.maven3.agent.Maven33Main, 
    F:\apache-maven-3.5.0-bin\apache-maven-3.5.0, C:\Users\sougata 
    das\.jenkins\war\WEB-INF\lib\remoting-3.7.jar, C:\Users\sougata 
    das\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven33-interceptor-1.8.1.jar, 
    C:\Users\sougata 
    das\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.8.1.jar, 
    50831](Native Method) at 
    hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545) 
     at hudson.remoting.UserResponse.retrieve(UserRequest.java:253) at 
    hudson.remoting.Channel.call(Channel.java:830) at 
    hudson.maven.ProcessCache$MavenProcess.call(ProcessCache.java:161) 
     at 
    hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:873) 
     at 
    hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534) 
     at hudson.model.Run.execute(Run.java:1728) at 
    hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544) 
     at 
    hudson.model.ResourceController.execute(ResourceController.java:98) 
     at hudson.model.Executor.run(Executor.java:405) Caused by: 
    java.lang.reflect.InvocationTargetException  at 
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606)  at 
    hudson.maven.Maven3Builder.call(Maven3Builder.java:139)  at 
    hudson.maven.Maven3Builder.call(Maven3Builder.java:70) at 
    hudson.remoting.UserRequest.perform(UserRequest.java:153) at 
    hudson.remoting.UserRequest.perform(UserRequest.java:50) at 
    hudson.remoting.Request$2.run(Request.java:336)  at 
    hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) 
     at java.util.concurrent.FutureTask.run(FutureTask.java:262)  at 
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
     at 
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
     at java.lang.Thread.run(Thread.java:745) Caused by: 
    java.lang.Exception: java.lang.reflect.InvocationTargetException at 
    jenkins.maven3.agent.Maven33Main.launch(Maven33Main.java:179) ... 
    14 more Caused by: java.lang.reflect.InvocationTargetException at 
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606)  at 
    org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330) 
     at 
    org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238) 
     at jenkins.maven3.agent.Maven33Main.launch(Maven33Main.java:176) 
     ... 14 more Caused by: java.lang.NoSuchFieldError: 
    DEFAULT_USER_SETTINGS_FILE at 
    org.apache.maven.cli.DefaultMavenExecutionRequestBuilder.settings(DefaultMavenExecutionRequestBuilder.java:658) 
     at 
    org.apache.maven.cli.DefaultMavenExecutionRequestBuilder.getMavenExecutionRequest(DefaultMavenExecutionRequestBuilder.java:149) 
     at 
    org.jvnet.hudson.maven3.launcher.Maven33Launcher.getMavenExecutionRequest(Maven33Launcher.java:150) 
     at 
    org.jvnet.hudson.maven3.launcher.Maven33Launcher.main(Maven33Launcher.java:127) 
     ... 21 more channel stopped Finished: FAILURE 

Odpowiedz

4

Komunikat o błędzie Caused by: java.lang.NoSuchFieldError: DEFAULT_USER_SETTINGS_FILE następuje w drodze emisji JENKINS-43446

To bilet obejmuje następujący komentarz:

Musiałem po prostu określić zarówno plik użytkownika i ustawienia globalne w sekcji "Zaawansowane" sekcji "Kompilacja". Jeśli zostawię jedno z tych ustawień w domyślnej konfiguracji, otrzymam te błędy.

Jak podkreślił mirabilos w the comments i wyszczególnione przez Wouter C „s answer:

Moje rozwiązanie było ustawić zmienić konfigurację kompilacji:

W Configure > Build > Advanced:

  • Ustaw Settings file na Settings file in filesystem i wprowadź ścieżkę do twój plik ustawień. W moim przypadku: /root/.m2/settings.xml
  • Ustaw Global Settings file na Global settings file on filesystem i wprowadź ścieżkę do pliku ustawień globalnych.
    Nie mam jednego (myślę), więc po prostu ustawić go również na /root/.m2/settings.xml.
+0

Zobacz także https://stackoverflow.com/a/43832242/2171120, aby uzyskać więcej informacji o tym, jak to zrobić. – mirabilos

+0

@mirabilos Dziękuję. Zawarłem to odniesienie w odpowiedzi, aby uzyskać lepszą widoczność. – VonC