Hygieia: Hygieiaâ„  plugin for Jenkins + jdk1.7

Created on 29 Nov 2016  Â·  5Comments  Â·  Source: hygieia/hygieia

Hi I've been able to compile jenkins plugin using jdk 1.7 , but after deploying it in jenkins I can see in the logs:

RunListener failed

java.lang.UnsupportedClassVersionError: com/capitalone/dashboard/request/BuildDataCreateRequest
    at jenkins.plugins.hygieia.ActiveNotifier.getBuildData(ActiveNotifier.java:166)
    at jenkins.plugins.hygieia.ActiveNotifier.completed(ActiveNotifier.java:83)
    at jenkins.plugins.hygieia.HygieiaListener.onCompleted(HygieiaListener.java:27)
    at jenkins.plugins.hygieia.HygieiaListener.onCompleted(HygieiaListener.java:15)
    at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:201)
    at hudson.model.Run.execute(Run.java:1786)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:408)

Also I tried to compile the "core" folder with jdk1.7 but it is alwais failing , is there any solution or Am I doing something wrong?

thanks in advance

question

All 5 comments

to make this work, you need to do few extra steps.

  1. Rebuild core using 1.7 and do mvn clean install on your laptop. This will put 1.7 compiled version of core in your local maven repo. You will need to comment out the lines that are 1.8 features. See the compilation errors and comment out those lines.
  2. Rebuild Jenkins plugin. This time this should use the core jar from local maven repo.

Also, to handle this cleanly, we will refactor core and move some classes out of it to break the dependency.

thanks for answering , I just did it pom.xml:

action 1:

               <configuration>
                 <source>1.7</source>
               </configuration>

error 1:

[INFO] Compiling 120 source files to /home/dashboard/Hygieia/core/target/classes
javacTask: source release 1.7 requires target release 1.7

action 2:

             <configuration>
               <source>1.8</source>
              <target>1.7</target>
             </configuration>

error 2:

[INFO] Compiling 158 source files to /home//dashboard/Hygieia/core/target/classes
javacTask: source release 1.8 requires target release 1.8

action 3: comment out 1.8 features

+       <!--   <configuration>
             <source>1.8</source>
             <target>1.8</target>
+          </configuration> -->

error 3:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project core: Compilation failure: Compilation failure:
[ERROR] /home/dashboard/Hygieia/core/src/main/java/com/capitalone/dashboard/model/CollectorItem.java:[32,54] diamond operator is not supported in -source 1.6
[ERROR] (use -source 7 or higher to enable diamond operator)

Is there another 1.8 features to comment out? I have commented :

  <!--      <configuration>
                <source>1.8</source>
                <target>1.8</target>
              </configuration> -->

Action 2 was what worked for me. You just have to change the target to 1.7 in two places.

Also, just commented out any of the 1.8 java code in the core module (pretty much anything that used lambdas). which was just the stuff in CommitEventListener.java and it's corresponding test.

Closing this as the problem was resolved.

Was this page helpful?
0 / 5 - 0 ratings