Teamcity,使用父依赖构建maven项目

时间:2014-10-07 12:52:55

标签: java maven intellij-idea teamcity pom.xml

我在teamcity服务器中有一个项目有一个子项目。子项目具有引用父项目的pom.xml文件。

这是项目的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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>it.company.project</groupId>
  <artifactId>MyProject</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>MyProject</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <modules>
    <module>Foo</module>
  </modules>
</project>

这是子项目的pom.xml:

<?xml version="1.0"?>
<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>

    <parent>
        <groupId>it.company.project</groupId>
        <artifactId>MyProject</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <artifactId>Foo</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>subproject</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.java</include>
                </includes>
            </resource>
        </resources>
    </build>
</project>

当我在我的子项目上从我的IDE(IntelliJ IDEA)运行maven构建时,一切正常。此外,当我在父项目上运行maven build时,一切正常。

当我在子项目上从TeamCity服务器运行构建代理(配置为运行pom.xml)时,它不起作用,我有以下错误:

[Step 1/1] Error reading Maven project: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM: Could not find artifact it.company.project:MyProject:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13
.
[14:08:12][Step 1/1] TeamCity is unable to read Maven project. Some features may be unavailable

当我在父项目上从TeamCity服务器运行构建代理(配置为运行pom.xml)时,它不起作用,我有以下错误:

An error occurred during collecting Maven project information: File not found in any VCS root: subproject/pom.xml.

我的子项目构建配置:

enter image description here

怎么了?


由于

0 个答案:

没有答案