java - Jenkins vs SonarQube : Run with specific JDK -


i have project built , compiled jdk 1.7 , sonarqube 6.0 runs jdk 1.8. on jenkins dashboard, set goal: :org.codehaus.mojo:sonar-maven-plugin:latest:sonar , on wrapper.conf on sonarqube folder, changed wrapper.java.command=c:\program files\java\jdk1.8.0_91\bin\java, jenkins jdk set 1.7....but sonar doesn't work jdk 1.8. please give me advise.

i had similar problem.

the solution set jdk8 used in job-configuration in jenkins , set jdk7 used compilation of sources, test-sources , surefire plugin.

something this:

        <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-compiler-plugin</artifactid>             <version>2.5.1</version>             <configuration>                 <source>1.5</source>                 <target>1.5</target>                 <testsource>1.7</testsource>                 <testtarget>1.7</testtarget>                 <verbose>true</verbose>                 <fork>true</fork>                 <executable>c:\java\jdk1.7.0_25\bin\javac</executable>                 <compilerversion>1.7</compilerversion>             </configuration>             <executions>                 <execution>                     <id>test-compile</id>                     <phase>process-test-sources</phase>                     <goals>                         <goal>testcompile</goal>                     </goals>                     <configuration>                         <fork>true</fork>                         <executable>c:\java\jdk1.7.0_25\bin\javac</executable>                         <source>1.5</source>                         <target>1.5</target>                         <compilerversion>1.7</compilerversion>                     </configuration>                 </execution>             </executions>         </plugin>          <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-surefire-plugin</artifactid>             <configuration>                 <jvm>c:\java\jdk1.7.0_25\bin\java</jvm>                 <forkmode>once</forkmode>             </configuration>         </plugin> 

if works you, can set path jdk in settings.xml , use setting in pom.xml each environment/developer can use own jdk.

<profile>   <id>jdk7</id>   <properties>     <jdk_1_7_home>c:\java\jdk1.7.0_25</jdk_1_7_home>   </properties>   <activation>     <activebydefault>true</activebydefault>   </activation> </profile> 

and pom.xml

...     <executable>${jdk_1_7_home}/bin/javac</executable> ... 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -