我对maven的声纳分析有问题。 在我的pom.xml中我定义了一个标签 我的pom.xml文件:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
<modelVersion 4.0.0</modelVersion>
<groupId>com.myorg</groupId>
<artifactId>android-project</artifactId>
<name>android project</name>
<version>2.3.${HUDSON_SVN_REVISION}</version>
<build>
<sourceDirectory>src</sourceDirectory>
<outputDirectory>bin</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<excludes>
<exclude>**/*.*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<sonar.dynamicAnalysis>false</sonar.dynamicAnalysis>
<libraries>libs/android.jar</libraries>
</properties>
</project>
我使用声纳插件在哈德森运行maven,构建成功但我在哈德森的输出日志中有一些警告:
[INFO] Findbugs output report: C:\hudson\jobs\test_sonar_pdf\workspace\target\sonar\findbugs-result.xml
The following classes needed for analysis were missing:
android.appwidget.AppWidgetProvider
android.os.AsyncTask
android.app.Activity
...
但我确定android.jar位于libs文件夹下。 也许有语法问题? 谢谢你的帮助。
答案 0 :(得分:2)
该标记仅用于Ant任务或Simple Java Runner。
使用Maven,您必须使用POM的标准Maven部分定义依赖关系(请参阅http://maven.apache.org/pom.html#Dependencies)。
答案 1 :(得分:2)
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myorg</groupId>
<artifactId>android-project</artifactId>
<name>android project</name>
<!-- Dans hudson, dans action a la suite du build, dans la partie sonar, dans propriete additionelles, ajouter
-DHUDSON_SVN_REVISION=${SVN_REVISION} -->
<version>2.3.${HUDSON_SVN_REVISION}</version>
<dependencies>
<dependency>
<groupId>deps</groupId>
<artifactId>dep1</artifactId>
<version>0.1</version>
<scope>system</scope>
<systemPath>${basedir}/libs/edtftpj.jar</systemPath>
</dependency>
</dependencies>
<dependency>
<groupId>deps</groupId>
<artifactId>dep2</artifactId>
<version>0.2</version>
<scope>system</scope>
<systemPath>C:\android\android-sdk-windows\platforms\android-7\android.jar</systemPath>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<outputDirectory>bin</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<excludes>
<exclude>**/*.*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<sonar.dynamicAnalysis>false</sonar.dynamicAnalysis>
</properties>
</project>