【问题标题】:mvn sonar:sonar do not use <libraries> in pom.xmlmvn sonar:sonar 不要在 pom.xml 中使用 <libraries>
【发布时间】:2012-03-22 15:07:05
【问题描述】:

我在 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>

我使用声纳插件在 hudson 中运行 maven,构建成功,但我在 hudson 的输出日志中有一些警告:

[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 文件夹下。 也许有语法问题? 感谢您的帮助。

【问题讨论】:

    标签: maven libraries sonarqube hudson-plugins


    【解决方案1】:

    标签仅用于 Ant 任务或 Simple Java Runner。

    使用 Maven,您必须使用 POM 的标准 Maven 部分定义您的依赖项(请参阅http://maven.apache.org/pom.html#Dependencies)。

    【讨论】:

      【解决方案2】:

      感谢Fabrice,ly 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>
      <!-- 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>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-07-17
        • 2016-06-21
        • 2013-02-05
        • 2017-12-19
        • 2011-03-04
        • 2013-02-16
        • 1970-01-01
        • 2013-10-09
        相关资源
        最近更新 更多