Maven中的模块间依赖

编程入门 行业动态 更新时间:2024-10-28 22:24:35
本文介绍了Maven中的模块间依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想构建具有EJB模块和WEB模块的Maven项目,而在WEB模块中需要EJB.

I want to build maven project having EJB module and WEB module, where EJB is needed in WEB module.

父pom.xml

<modelVersion>4.0.0</modelVersion> <groupId>cz.literak.oauth</groupId> <artifactId>OAuthLogin</artifactId> <packaging>pom</packaging> <version>1.0-SNAPSHOT</version> <modules> <module>OAuthLogin-web</module> <module>OAuthLogin-ejb</module> </modules> <name>OAuthLogin JEE Skeleton</name> <url>www.literak.cz/OAuthLogin/</url>

EJB pom.xml

<parent> <artifactId>OAuthLogin</artifactId> <groupId>cz.literak.oauth</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>OAuthLoginEJB</artifactId> <version>1.0-SNAPSHOT</version> <packaging>ejb</packaging> <name>OAuthLoginEJB Beans</name>

WEB pom.xml

<parent> <artifactId>OAuthLogin</artifactId> <groupId>cz.literak.oauth</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>OAuthLoginWEB</artifactId> <packaging>war</packaging> <name>OAuthLogin Webapp</name> <dependencies> <dependency> <groupId>cz.literak.oauth</groupId> <artifactId>OAuthLogin-ejb</artifactId> <version>1.0-SNAPSHOT</version> <type>jar</type> <scope>compile</scope> </dependency> </dependencies>

Intellij Idea告诉我该版本未知.当我在父模块中运行 mvn clean install 时,它失败并显示:

Intellij Idea tells me that version is unknown. When I run mvn clean install in parent module, it fails with:

[ERROR] Failed to execute goal on project OAuthLoginWEB: Could not resolve dependencies for project cz.literak.oauth:OAuthLoginWEB:war:1.0-SNAPSHOT: Could not find artifact cz.literak.oauth:OAuthLogin-ejb:jar:1.0-SNAPSHOT -> [Help 1]

问题出在哪里?我没有运气就浏览了类似的问题.谢谢.

Where is the issue? I browsed similar questions without luck. Thanks.

推荐答案

您已经定义了ejb模块的artifactId,如下所示:

You have defined the artifactId of your ejb module like this:

<artifactId>OAuthLoginEJB</artifactId>

但不是

<artifactId>OAuthLogin-ejb</artifactId>

但您的依赖程度是这样的:

BUT YOUR DEPENDENCY is like this:

<dependencies> <dependency> <groupId>cz.literak.oauth</groupId> <artifactId>OAuthLogin-ejb</artifactId> <version>1.0-SNAPSHOT</version> <type>ejb</type> </dependency> </dependencies>

更多推荐

Maven中的模块间依赖

本文发布于:2023-11-22 09:03:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1616801.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模块   Maven

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!