我使用Ant任务进行非常简单的Sonar配置:
<target name="upload_to_sonar">
<property name="sonar.jdbc.url" value="jdbc:oracle:thin:@server:1521:sid"/>
<property name="sonar.host.url" value="http://sonar:80"/>
<property name="sonar.jdbc.username" value="SONAR"/>
<property name="sonar.jdbc.password" value="SONAR"/>
<property name="sonar.projectKey" value="test"/>
<property name="sonar.projectName" value="test"/>
<property name="sonar.projectVersion" value="trunk"/>
<property name="sonar.language" value="java"/>
<property name="sonar.sources" value="sources_for_sonar"/>
<property name="sonar.binaries" value="classes_for_sonar"/>
<taskdef name="sonar" classname="org.sonar.ant.SonarTask">
<classpath path="${EXTERNAL}/sonar-ant-task-2.0.jar" />
</taskdef>
<sonar/>
</target>
这些文件夹包含根级别的源和类 出于某种原因,无论我如何配置,执行都会给我以下错误:
Buildfile: D:\trunk\src\build.xml
upload_to_sonar:
[sonar:sonar] Apache Ant(TM) version 1.8.2 compiled on December 20 2010
[sonar:sonar] Sonar Ant Task version: 2.0
[sonar:sonar] Loaded from: file:/D:/trunk/src/./sources/external/sonar-ant-task-
2.0.jar
[sonar:sonar] Sonar work directory: D:\trunk\src\.sonar
[sonar:sonar] Sonar server: http://sonar:80
BUILD FAILED
D:\trunk\src\build.xml:132: org.sonar.runner.RunnerException: java.lang.IllegalS
tateException: Infinite loop in property interpolation of ${SQLSCRIPT}: SQLSCRIP
T
at org.sonar.runner.Runner.delegateExecution(Runner.java:288)
at org.sonar.runner.Runner.execute(Runner.java:151)
at org.sonar.ant.SonarTask.launchAnalysis(SonarTask.java:93)
at org.sonar.ant.SonarTask.execute(SonarTask.java:75)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.IllegalStateException: Infinite loop in property interpolat
ion of ${SQLSCRIPT}: SQLSCRIPT
at org.apache.commons.lang.text.StrSubstitutor.checkCyclicSubstitution(S
trSubstitutor.java:701)
at org.apache.commons.lang.text.StrSubstitutor.substitute(StrSubstitutor
.java:645)
at org.apache.commons.lang.text.StrSubstitutor.substitute(StrSubstitutor
.java:656)
at org.apache.commons.lang.text.StrSubstitutor.substitute(StrSubstitutor
.java:563)
at org.apache.commons.lang.text.StrSubstitutor.replace(StrSubstitutor.ja
va:305)
at org.apache.commons.configuration.PropertyConverter.interpolate(Proper
tyConverter.java:958)
at org.apache.commons.configuration.AbstractConfiguration.interpolate(Ab
stractConfiguration.java:446)
at org.apache.commons.configuration.CompositeConfiguration.getList(Compo
siteConfiguration.java:312)
at org.apache.commons.configuration.AbstractConfiguration.getList(Abstra
ctConfiguration.java:1109)
at org.apache.commons.configuration.CompositeConfiguration.getStringArra
y(CompositeConfiguration.java:320)
at org.sonar.batch.Batch.convertToProperties(Batch.java:89)
at org.sonar.batch.Batch.create(Batch.java:78)
at org.sonar.runner.internal.batch.Launcher.executeBatch(Launcher.java:6
8)
at org.sonar.runner.internal.batch.Launcher.execute(Launcher.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.sonar.runner.Runner.delegateExecution(Runner.java:285)
... 19 more
Total time: 1 minute 12 seconds
SONAR服务器版本为3.2
Ant任务版本2.0
启用详细程度不会提供任何其他详细信息