Java 解析maven多模块项目的依赖项时出错

Java 解析maven多模块项目的依赖项时出错,java,eclipse,jenkins,maven-2,multi-module,Java,Eclipse,Jenkins,Maven 2,Multi Module,我已经建立了一个包含两个模块的多模块maven项目,dw web和dw test Parent - dw-web - dw-test 父pom: <modelVersion>4.0.0</modelVersion> <groupId>com.dw</groupId> <artifactId>dw-parent</artifactId> <version>1.0</vers

我已经建立了一个包含两个模块的多模块maven项目,dw web和dw test

Parent
  - dw-web
  - dw-test
父pom:

<modelVersion>4.0.0</modelVersion>

    <groupId>com.dw</groupId>
    <artifactId>dw-parent</artifactId>
    <version>1.0</version>
    <packaging>pom</packaging>

    <modules>
        <module>dw-web</module>
        <module>dw-test</module>
    </modules>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                    <configuration>
                        <release>11</release>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
一些参考资料表明,本地m2存储库或MyIDE(eclipse)似乎在缓存生成的jar?我是否必须通过系统标签导入jar,然后将maven指向jar,或者将其上传到nexus存储库以解决依赖性错误?多模块项目不应该解决这些项目之间的任何依赖关系,而不必启动构建项目并将其下载到外部实体吗?

父级pom应该是一个“聚合器”,也就是说,它应该包括dw web和dw test的模块,并且本身有一个打包pom:

<project>
    ...
     <packaging>pom</packaging>

     <modules>
        <module>dw-web</module>
        <module>dw-test</module>
     </modules>
</project>

...
聚甲醛
数据仓库网
dw试验
通过此设置,maven将自动解析依赖关系图,并按照正确的顺序编译所有内容(
dw-web
,然后
dw-test

因此,请确保您有这样的设置。
当然也可能有其他原因,最好是从问题中的所有pom文件中添加相关的代码片段

问题的解决方案是,我在父pom中将
dw-web
声明为模块和依赖项。删除依赖项声明后,项目将编译。

感谢您的快速回答。我从pom文件中添加了相关部分。反应堆的命令是正确的。家长->网络->测试
<modelVersion>4.0.0</modelVersion>
<artifactId>dw-web</artifactId>
<packaging>jar</packaging>
<version>1.0</version>

<parent>
    <groupId>com.dw</groupId>
    <artifactId>dw-parent</artifactId>
    <version>1.0</version>
</parent>
<dependency>
  <groupId>com.dw</groupId>
  <artifactId>dw-web</artifactId>
  <version>1.0</version>
</dependency>
Failed to execute goal on project dw-test: Could not resolve dependencies for project com.dw:dw-test:jar:1.0: Failure to find com.dw:dw-web:jar:1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
<project>
    ...
     <packaging>pom</packaging>

     <modules>
        <module>dw-web</module>
        <module>dw-test</module>
     </modules>
</project>