0

当我尝试在詹金斯上启动声纳时,出现以下错误:

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar (default-cli) on project project.pom: 
The folder '/path/to/file/project.core/pom.xml' does not exist for 'project:project.core' 
(base directory = /path/to/folder/project.core) -> [Help 1] 

我认为这是因为 sonarsource 正在寻找一个文件夹,并且路径找到了一个 pom.xml 文件,但我不明白为什么。

我的 Maven 项目有以下文件树:

project.pom
   pom.xml
   project.core
      pom.xml
   project.backend
      pom.xml
  ....

编辑:根 pom.xml

   <?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>project</groupId>
  <artifactId>project.pom</artifactId>
  <version>X.Y.Z</version>
  <packaging>pom</packaging>
  <name>My project</name>
  <description>My project</description>
  <prerequisites>
    <maven>${maven.version.min}</maven>
  </prerequisites>
  <modules>
    <module>project.core</module>
    <module>project.backend</module>
  </modules>
  <distributionManagement>
    <repository>
      //repositories
    </repository>
    <snapshotRepository>
      //repositories
    </snapshotRepository>
  </distributionManagement>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>project</groupId>
        <artifactId>project.core</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>project</groupId>
        <artifactId>project.backend</artifactId>
        <version>${project.version}</version>
      </dependency>
  </dependencyManagement>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.sonarsource.scanner.maven</groupId>
          <artifactId>sonar-maven-plugin</artifactId>
          <version>3.0.2</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>1.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>
4

1 回答 1

0

Maven 过去使用 pom.xml 构建,它根据项目的预定义结构识别源文件和测试文件。在这种情况下,您必须明确提及文件路径。

您能否提供项目根文件夹中的 pom.xml 文件?

于 2016-05-18T05:38:36.383 回答