[英]Maven doesn't see dependency
我試圖將依賴性添加到一個模塊。 這是代碼:
<dependency>
<groupId>com.messagedna.dlp</groupId>
<artifactId>producer</artifactId>
<version>1.0</version>
</dependency>
這是模塊producer
的pom文件的一部分:
<parent>
<artifactId>DLP</artifactId>
<groupId>com.messagedna.dlp</groupId>
<version>1.0</version>
</parent>
<groupId>com.messagedna.dlp</groupId>
<artifactId>producer</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>producer</name>
但是當我嘗試編譯第一個模塊時,我得到以下信息:
Downloading: http://repo1.maven.org/maven2/com/messagedna/dlp/producer/1.0/producer-1.0.pom
[INFO] Unable to find resource 'com.messagedna.dlp:producer:pom:1.0' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/com/messagedna/dlp/producer/1.0/producer-1.0.jar
[INFO] Unable to find resource 'com.messagedna.dlp:producer:jar:1.0' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) com.messagedna.dlp:producer:jar:1.0
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.messagedna.dlp -DartifactId=producer -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.messagedna.dlp -DartifactId=producer -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) com.messagedna.dlp:DLPServer:war:1.0-SNAPSHOT
2) com.messagedna.dlp:producer:jar:1.0
----------
1 required artifact is missing.
for artifact:
com.messagedna.dlp:DLPServer:war:1.0-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
如何打造?
看來您尚未在生產者項目與依賴它的項目之間建立適當的父子關系。 在進行設置之前,您需要先在生產者項目上手動運行mvn install
,然后再嘗試構建任何依賴它的項目。
要在maven中使用庫,必須
如果不是所有這些,則需要遵循maven給您的指示。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.