我将SonarQube安装从4.0更新到5.1.1完全(我发誓)像写in the Upgrade Document
应用程序运行......一切都很好......
只有Ant任务不起作用......
我得到了Sonar Ant Jar in Version 2.2 非版本2.3 (你可以看到Compatibility Matrix here)
我的Ant任务看起来像
<target name="sonar_apak">
<property name="sonar.jdbc.url" value="jdbc:jtds:sqlserver://[server]/SonarCube;SelectMethod=Cursor" />
<property name="sonar.jdbc.username" value="XX" />
<property name="sonar.jdbc.password" value="XX" />
<property name="sonar.projectKey" value="XX" />
<property name="sonar.projectName" value="XX" />
<property name="sonar.projectVersion" value="${jenkins.apak.version}.${jenkins.build.version}" />
<property name="sonar.language" value="js" />
<property name="sonar.sources" value="${web.docbase.dir}\api" />
<property name="sonar.sourceEncoding" value="UTF-8" />
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath path="c:/Ant/extras/sonar-ant-task-*.jar" />
</taskdef>
<!-- Execute Sonar -->
<sonar:sonar />
</target>
在Sonar wrapper.conf中 wrapper.java.command = java的
所以我的
java -version
打印出来
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) Client VM (build 25.45-b02, mixed mode)
当我使用
在控制台上运行任务时ant sonar_apak
这是输出
sonar_apak:
[sonar:sonar] Apache Ant(TM) version 1.9.2 compiled on July 8 2013
[sonar:sonar] SonarQube Ant Task version: 2.2
[sonar:sonar] Loaded from: file:/C:/Ant/lib/sonar-ant-task-2.2.jar
[sonar:sonar] INFO: Default locale: "de_DE", source code encoding: "UTF-8"
[sonar:sonar] INFO: Work directory: d:\.jenkins\workspace\APAK\.sonar
[sonar:sonar] INFO: SonarQube Server 5.1.1
BUILD FAILED
d:\.jenkins\workspace\APAK\build.xml:106: java.lang.UnsupportedClassVersionError: org/sonar/api/utils/SonarException : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.sonar.runner.impl.IsolatedClassloader.loadClass(IsolatedClassloader.java:94)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getMethod0(Class.java:2670)
at java.lang.Class.getMethod(Class.java:1603)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:85)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.ant.SonarTask.launchAnalysis(SonarTask.java:53)
at org.sonar.ant.SonarTask.execute(SonarTask.java:48)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
我做错了什么?
答案 0 :(得分:1)
设置了一个指向veeery旧版本的JAVA_HOME变量。
谢谢你的提示!