Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
523 views
in Technique[技术] by (71.8m points)

maven - Maven多项目层次结构依赖性问题(Maven multi-project hierarchy dependencies problem)

I have a multi project with inner dependencies.

(我有一个内部依赖的多项目。)

When I try to build all the projects from the parent pom I get this error:

(当我尝试从父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

But utils project is build in the parent.

(但是utils项目是在父级中构建的。)

When I add another pom file that inheritor from the project patent and add all the modules project to this pom (like a parent without the dependencyManagement and the pluginManagement) its compile successfully.

(当我添加另一个从项目专利继承的pom文件并将所有模块项目添加到该pom(就像没有dependencyManagement和pluginManagement的父级)时,其编译成功。)

The parent pom:

(父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>

The second pom ("like a parent"):

(第二个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>

The child pom:

(儿童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>

The second child:

(第二个孩子:)

   <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?
  ask by yiaca translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

My best guess:

(我最好的猜测:)

You have mixed up the groupIds somewhere because you use com.radware , com.radware.insite and com.insite at different places in your question.

(您在某个地方混用了groupId,因为在问题的不同位置使用了com.radwarecom.radware.insitecom.insite 。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...