1. <legend id='wz79Z'><style id='wz79Z'><dir id='wz79Z'><q id='wz79Z'></q></dir></style></legend>

      <tfoot id='wz79Z'></tfoot>
      <i id='wz79Z'><tr id='wz79Z'><dt id='wz79Z'><q id='wz79Z'><span id='wz79Z'><b id='wz79Z'><form id='wz79Z'><ins id='wz79Z'></ins><ul id='wz79Z'></ul><sub id='wz79Z'></sub></form><legend id='wz79Z'></legend><bdo id='wz79Z'><pre id='wz79Z'><center id='wz79Z'></center></pre></bdo></b><th id='wz79Z'></th></span></q></dt></tr></i><div id='wz79Z'><tfoot id='wz79Z'></tfoot><dl id='wz79Z'><fieldset id='wz79Z'></fieldset></dl></div>

        <small id='wz79Z'></small><noframes id='wz79Z'>

          <bdo id='wz79Z'></bdo><ul id='wz79Z'></ul>
      1. MavenError:无法在项目上执行目标:无法解决Maven Multimodule项目中的依赖关系

        时间:2023-07-13

        1. <tfoot id='e7T3u'></tfoot>
            <i id='e7T3u'><tr id='e7T3u'><dt id='e7T3u'><q id='e7T3u'><span id='e7T3u'><b id='e7T3u'><form id='e7T3u'><ins id='e7T3u'></ins><ul id='e7T3u'></ul><sub id='e7T3u'></sub></form><legend id='e7T3u'></legend><bdo id='e7T3u'><pre id='e7T3u'><center id='e7T3u'></center></pre></bdo></b><th id='e7T3u'></th></span></q></dt></tr></i><div id='e7T3u'><tfoot id='e7T3u'></tfoot><dl id='e7T3u'><fieldset id='e7T3u'></fieldset></dl></div>

            <legend id='e7T3u'><style id='e7T3u'><dir id='e7T3u'><q id='e7T3u'></q></dir></style></legend>

                • <bdo id='e7T3u'></bdo><ul id='e7T3u'></ul>
                    <tbody id='e7T3u'></tbody>
                • <small id='e7T3u'></small><noframes id='e7T3u'>

                  本文介绍了MavenError:无法在项目上执行目标:无法解决Maven Multimodule项目中的依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试创建一个 Maven 多模块项目.该项目已成功创建,但是当我尝试将一个模块用作另一个模块的依赖项时,它会引发异常.当我使用 eclipse 创建模块时,我选择打包为 jar,但是在创建模块时,子 pom.xml 中没有提及打包标签,我手动将打包标签插入为 jar.以下是我的父 pom.xml:

                  I am trying to create a maven multi-module project. the project is created successfully but when I am trying to use one module as a dependency of another module, it throws an exception. When I create a module using eclipse, I was selecting packaging as a jar, but when the module is created, the packaging tag was not mention in child pom.xml and I manually insert the packaging tag as a jar. following is my parent pom.xml:

                  <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.netsol</groupId>
                  <artifactId>empirecl</artifactId>
                  <version>0.0.1-SNAPSHOT</version>
                  <packaging>pom</packaging>
                  -------------------------
                  <modules>
                      <module>empirecl-web</module>
                      <module>empirecl-dao</module>
                      <module>empirecl-service</module>
                      <module>empirecl-api</module>
                  </modules>
                  

                  道子模块:

                  <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>
                      <groupId>com.netsol</groupId>
                      <artifactId>empirecl</artifactId>
                      <version>0.0.1-SNAPSHOT</version>
                      <relativePath>../pom.xml</relativePath>
                  </parent>
                  <artifactId>empirecl-dao</artifactId>
                  <packaging>jar</packaging>
                  <name>empirecl-dao</name>
                  ------------------------
                  

                  服务子模块:

                  <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>
                      <groupId>com.netsol</groupId>
                      <artifactId>empirecl</artifactId>
                      <version>0.0.1-SNAPSHOT</version>
                      <relativePath>../pom.xml</relativePath>
                  </parent>
                  <artifactId>empirecl-service</artifactId>
                  <packaging>jar</packaging>
                  <name>empirecl-service</name>
                  
                  <dependencies>
                      <dependency>
                          <groupId>com.netsol</groupId>
                          <artifactId>empirecl-dao</artifactId>
                          <version>0.0.1-SNAPSHOT</version>
                          <type>jar</type>
                      </dependency>
                  ------------------------------------------
                  

                  dao模块maven清理安装成功,但是当我尝试使用service模块时,会产生如下异常:

                  The Dao module maven clean and install successfully, but when i trying to use service module, it will generate an following exception:

                  [ERROR] Failed to execute goal on project empirecl-service: Could not resolve dependencies for project com.netsol:empirecl-service:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.netsol:empirecl-dao:jar:0.0.1-SNAPSHOT: Failed to read artifact descriptor for com.netsol:empirecl-dao:jar:0.0.1-SNAPSHOT: Could not find artifact com.netsol:empirecl:pom:0.0.1-SNAPSHOT -> [Help 1]
                  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project empirecl-service: Could not resolve dependencies for project com.netsol:empirecl-service:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.netsol:empirecl-dao:jar:0.0.1-SNAPSHOT
                  

                  我正在尝试从网络上查找解决方案,但仍未找到解决方案.在 Eclipse 中,当我打开服务模块的 Dependency Hierarchy 时,它将 DAO 模块显示为文件夹而不是 jar.下面是服务模块的Dependency Hierarchy的截图.

                  I am trying the find to solution from web, but still the solution is not found. In eclipse when i open the Dependency Hierarchy of service module, it shown the DAO module as a folder not jar. below is the screen shot of Dependency Hierarchy of service module.

                  推荐答案

                  如果有人回到这个问题,我认为这里的问题是未能首先安装父 pom,所有这些子模块都依赖它,所以 Maven Reactor 无法收集构建所需的依赖项子模块.

                  In case anybody comes back to this, I think the problem here was failing to install the parent pom first, which all these submodules depend on, so the Maven Reactor can't collect the necessary dependencies to build the submodule.

                  所以从根目录(这里是D:luna_workspaceempire_clubempirecl)它可能只需要一个:

                  So from the root directory (here D:luna_workspaceempire_clubempirecl) it probably just needs a:

                  mvn clean install
                  

                  (旁白:<relativePath>../pom.xml</relativePath> 并不是真正需要的,因为 这是默认值).

                  (Aside: <relativePath>../pom.xml</relativePath> is not really necessary as it's the default value).

                  这篇关于MavenError:无法在项目上执行目标:无法解决Maven Multimodule项目中的依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将 jar 打包到具有分离的外部资源和依赖项的 dist 目录中 下一篇:Maven中相同依赖项的不同版本

                  相关文章

                    <bdo id='3X65E'></bdo><ul id='3X65E'></ul>

                  <i id='3X65E'><tr id='3X65E'><dt id='3X65E'><q id='3X65E'><span id='3X65E'><b id='3X65E'><form id='3X65E'><ins id='3X65E'></ins><ul id='3X65E'></ul><sub id='3X65E'></sub></form><legend id='3X65E'></legend><bdo id='3X65E'><pre id='3X65E'><center id='3X65E'></center></pre></bdo></b><th id='3X65E'></th></span></q></dt></tr></i><div id='3X65E'><tfoot id='3X65E'></tfoot><dl id='3X65E'><fieldset id='3X65E'></fieldset></dl></div>

                  1. <small id='3X65E'></small><noframes id='3X65E'>

                      <legend id='3X65E'><style id='3X65E'><dir id='3X65E'><q id='3X65E'></q></dir></style></legend>
                      <tfoot id='3X65E'></tfoot>