Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何获取依赖关系?_Java_Eclipse_Maven - Fatal编程技术网

Java 如何获取依赖关系?

Java 如何获取依赖关系?,java,eclipse,maven,Java,Eclipse,Maven,我创建了一个包含多个Java项目的项目,每个项目都有自己的依赖项 一个项目是主项目,使用所有其他项目,但不是直接使用。例如: 假设我有三个项目的A、B和C,A是主项目(应用程序)。A使用B作为依赖项,而B使用C作为依赖项,项目C有自己的外部依赖项 我的团队中的每个人都有权只下载一个项目,并将根据需要使用其他项目作为依赖项。 团队中出现的问题是,在开发主项目时,Maven没有将B&C依赖项下载到本地机器上 以下是每个pom的pom文件: A(主要项目) com.a.c D 1.0.0 带有依赖项

我创建了一个包含多个Java项目的项目,每个项目都有自己的依赖项

一个项目是主项目,使用所有其他项目,但不是直接使用。例如:

假设我有三个项目的A、B和C,A是主项目(应用程序)。A使用B作为依赖项,而B使用C作为依赖项,项目C有自己的外部依赖项

我的团队中的每个人都有权只下载一个项目,并将根据需要使用其他项目作为依赖项。 团队中出现的问题是,在开发主项目时,Maven没有将B&C依赖项下载到本地机器上

以下是每个pom的pom文件:

A(主要项目)


com.a.c
D
1.0.0
带有依赖项的jar
公地io
公地io
com.a.c
B
0.0.1
带有依赖项的jar
B:

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.a.c</groupId>
                <artifactId>C</artifactId>
                <version>0.0.1</version>
                <classifier>jar-with-dependencies</classifier>
            </dependency>
        </dependencies>
    </dependencyManagement>
<dependencies>
        <dependency>
            <groupId>org.jsystemtest</groupId>
            <artifactId>jsystemApp</artifactId>
            <version>6.1.01</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.50.0</version>
        </dependency>
    </dependencies>

com.a.c
C
0.0.1
带有依赖项的jar
C:

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.a.c</groupId>
                <artifactId>C</artifactId>
                <version>0.0.1</version>
                <classifier>jar-with-dependencies</classifier>
            </dependency>
        </dependencies>
    </dependencyManagement>
<dependencies>
        <dependency>
            <groupId>org.jsystemtest</groupId>
            <artifactId>jsystemApp</artifactId>
            <version>6.1.01</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.50.0</version>
        </dependency>
    </dependencies>

org.jsystemtest
jsystemApp
6.1.01
朱尼特
朱尼特
3.8.1
测试
org.seleniumhq.selenium
硒爪哇
2.50.0

为了在不下载每台机器的源代码的情况下获得B和C的依赖关系,我应该设置哪个配置?

您似乎把
混淆了<代码>在A和B中仅设置依赖项的版本,而不包括它们。这就是为什么Maven不会下载B的依赖项,因此也不会下载C的依赖项(除非在A和B中都有一个附加的
部分,而您没有显示)。

Maven以传递方式解决依赖项,这就是Maven的观点。您所说的“我的团队中的每个人都有权只下载一个项目”是什么意思?