Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ant 创建pom.xml文件_Ant_Maven 2_Sonarqube - Fatal编程技术网

Ant 创建pom.xml文件

Ant 创建pom.xml文件,ant,maven-2,sonarqube,Ant,Maven 2,Sonarqube,有人能给我一些关于如何为多模块项目创建pom.xml文件的建议吗?我需要创建这个pom.xml文件,以便使用Sonar分析项目。您在pom.xml中放置的内容将取决于您需要运行的内容和内容。查看以查看它的组成。我建议按照声纳文档中的说明操作。见: 具有多个源目录的项目 如果您的非maven项目包含 多个源目录,您可以 可以指定哪些源目录 通过添加新的部分进行分析 关于构建助手Maven插件 到pom.xml文件中: <project xmlns="http://maven.apache.o

有人能给我一些关于如何为多模块项目创建pom.xml文件的建议吗?我需要创建这个pom.xml文件,以便使用Sonar分析项目。

您在pom.xml中放置的内容将取决于您需要运行的内容和内容。查看以查看它的组成。

我建议按照声纳文档中的说明操作。见:

具有多个源目录的项目 如果您的非maven项目包含 多个源目录,您可以 可以指定哪些源目录 通过添加新的部分进行分析 关于构建助手Maven插件 到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>[YOUR.ORGANIZATION]</groupId>
  <artifactId>[YOUR.PROJECT]</artifactId>
  <name>[YOUR PROJECT NAME]</name>
  <version>[YOUR PROJECT VERSION]</version>
  <build>
        <sourceDirectory>[YOUR SOURCE DIRECTORY]</sourceDirectory>
        <outputDirectory>[YOUR CLASSES/BIN DIRECTORY</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>
           <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>build-helper-maven-plugin</artifactId>
              <version>1.1</version>
              <executions>
                <execution>
                  <id>add-source</id>
                  <phase>generate-sources</phase>
                  <goals>
                      <goal>add-source</goal>
                  </goals>
                  <configuration>
                      <sources>
                          <source>[YOUR SOURCE DIRECTORY 2]</source>
                          <source>[YOUR SOURCE DIRECTORY 3]</source>
                      </sources>
                  </configuration>
                </execution>
              </executions>
           </plugin>
        </plugins>
  </build>
  <properties>
        <sonar.dynamicAnalysis>false</sonar.dynamicAnalysis>
        <sonar.phase>generate-sources</sonar.phase>
  </properties>
</project>

我认为您可以尝试使用builder helper maven插件,目前,最新版本是1.5。 如文件所述。但是,只需将插件版本更改为1.5并使用mvn sonar3:sonar。最重要的是,别忘了生成源代码,没有这个,它就无法工作


对于输出目录,如果使用eclipse,可以为每个模块指定输出目录,并使它们指向同一文件夹。将此文件夹用作pom.xml的输出目录。如果使用eclipse,请记住禁用清理功能。

现在您可以使用一个,或者也有一个

是的,您是对的,但是我有点不明白如何为每个模块指定源目录。
mvn sonar:sonar