Maven多项目层次结构依赖性问题

问题描述 投票:0回答:1

我有一个具有内部依赖项的多项目。当我尝试从父pom构建所有项目时,出现此错误:

Could not resolve dependencies for project com.insite:model:ejb:1.00.00-SNAPSHOT: The following artifacts could not be resolved: com.insite:utils:jar:1.00.00-SNAPSHOT, Failure to find com.insite:utils:jar:1.00.00-SNAPSHOT in http://artifactory.crop.com:8081/artifactory/remote-repos was cached in the local repository, resolution will not be reattempted until 
the update interval of central has elapsed or updates are forced

但是utils项目是在父项中构建的。当我添加另一个从项目专利继承的pom文件并将所有模块项目添加到该pom中时(就像不带dependencyManagement和pluginManagement的父级一样),其编译成功。

[父pom:

?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.insite</groupId>
    <artifactId>parent</artifactId>
    <version>1.00.00-SNAPSHOT</version>
    <packaging>pom</packaging>

    <modules>
        <module>../utils</module>
        <module>../model</module>
    </modules>
  ...
</project>

第二个pom(“像父母一样” ::

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.insite</groupId>
        <artifactId>parent</artifactId>
        <version>1.00.00-SNAPSHOT</version>
        <relativePath>../parent/</relativePath>
    </parent>

    <artifactId>build_all</artifactId>
    <packaging>pom</packaging>

    <modules>
        <module>../utils</module>
        <module>../model</module>
    </modules>
</project>

儿童pom:

   <parent>
        <relativePath>../parent</relativePath>
        <groupId>com.insite</groupId>
        <artifactId>parent</artifactId>
        <version>1.00.00-SNAPSHOT</version>
    </parent>

    <groupId>com.insite</groupId>
    <artifactId>utils</artifactId>
    <name>Utilities</name>

第二个孩子:

   <parent>
        <relativePath>../parent</relativePath>
        <groupId>com.insite</groupId>
        <artifactId>parent</artifactId>
        <version>1.00.00-SNAPSHOT</version>
    </parent>

    <artifactId>model</artifactId>
    <packaging>ejb</packaging>
    <name>Model</name>

    <dependencies>
        <!-- Insite project dependencies -->
        <dependency>
            <groupId>com.insite</groupId>
            <artifactId>utils</artifactId>
        </dependency>

Why it field in the parent pom? Multi project not supposed to sport  inner dependencies?
maven dependencies pom.xml dependency-management
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.