Maven多模块项目试图从人工制品中获取本地模块的问题

时间:2018-09-06 13:26:55

标签: java maven module artifactory dependency-management

我有一段时间没有使用多模块Maven项目了,但是我正在尝试建立以下项目结构:

enter image description here

因此,您可以看到我有一组项目是父项目的“帮助程序自动化工具”。该父对象的基本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>com.proofofconcept.hat</groupId>
<artifactId>helper-automation-tool</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>helper-automation-tool</name>

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

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.proofofconcept.hat </groupId>
            <artifactId>helper-automation-tool-dataobjects</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.proofofconcept.hat </groupId>
            <artifactId>helper-automation-tool-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.proofofconcept.hat</groupId>
            <artifactId>helper-automation-tool-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.proofofconcept.hat</groupId>
            <artifactId>helper-automation-tool-utils</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.proofofconcept.hat</groupId>
            <artifactId>helper-automation-tool-ui</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
</dependencyManagement>

<modules>
    <module>helper-automation-tool-dataobjects</module>
    <module>helper-automation-tool-utils</module>
    <module>helper-automation-tool-core</module>
    <module>helper-automation-tool-api</module>
    <module>helper-automation-tool-ui</module>
</modules>

某些模块之间应具有依赖关系,我开始尝试使“ helper-automation-tool-core”具有“ helper-automation-tool-dataobjects”作为依赖关系之一,这是它们两者的配置:

helper-automation-tools-dataobjects

<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>
    <artifactId>helper-automation-tool</artifactId>
    <groupId>com.proofofconcept.hat</groupId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
</parent>

<artifactId>helper-automation-tool-dataobjects</artifactId>
<name>helper-automation-tool-dataobjects</name>
<packaging>jar</packaging>

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

helper-automation-tool-core

<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>
    <artifactId>helper-automation-tool</artifactId>
    <groupId>com.proofofconcept.hat</groupId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
</parent>

<artifactId>helper-automation-tool-core</artifactId>
<name>helper-automation-tool-core</name>
<packaging>jar</packaging>

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

<dependencies>
    <dependency>
        <groupId>com.proofofconcept.hat</groupId>
        <artifactId>helper-automation-tool-dataobjects</artifactId>
        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

</project>

我在核心中还有其他依赖项,例如spring框架或jackson映射器,但为了不增加帖子数量,我将它们排除在外。

在dataobjects项目上执行mvn clean install时,构建成功。

但是在内核上执行相同的命令时,我得到以下信息:

[ERROR] Failed to execute goal on project helper-automation-tool-core: Could not resolve dependencies for project com.proofofconcept.hat:helper-automation-tool-core:jar:1.0-SNAPSHOT: Failed to collect dependencies at com.proofofconcept.hat:helper-automation-tool-dataobjects:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for com.proofofconcept.hat:helper-automation-tool-dataobjects:jar:1.0-SNAPSHOT: Could not transfer artifact com.proofofconcept.hat:helper-automation-tool:pom:1.0-SNAPSHOT from/to platformServerGADeployement (https://repository.mycompany.com/artifactory/platformserver-ga/): Failed to transfer file: https://repository.mycompany.com/artifactory/platformserver-ga/com/proofofconcept/hat/helper-automation-tool/1.0-SNAPSHOT/helper-automation-tool-1.0-SNAPSHOT.pom. Return code is: 409 , ReasonPhrase:Conflict.

这似乎是一个问题,因为核心正在尝试从人工制品中获取数据对象项目,因为我正在使用settings.xml文件,该文件已配置了该项目所需的人工制品仓库,因为我们需要下载spring和杰克逊从那里的依赖。

同样,当我从父项目目录编译整个内容时,我得到的消息是dataobjects组件不存在(我已经从那里引用了一些类和接口)。

我想知道是否有任何方法或解决方法来解决此问题,也许我需要在settings.xml或核心的pom.xml中进行一些其他配置以考虑我的本地存储库。

任何帮助将不胜感激。预先感谢。

0 个答案:

没有答案