[英]How to add a Maven project as dependency in another maven project and make live changes to it instead of JAR dependency
[英]Eclipse - How to add a project as a Maven dependency to another, instead of adding as a jar?
我有兩個Maven項目。 一個應該是對另一個的依賴。 兩者都有pom.xml文件。 當我搜索存儲庫時,它會看到本地項目並自動添加。
添加時的pom.xml條目:
<dependencies>
<dependency> // for another dependency, an external jar
<groupId>..</groupId>
<artifactId>..</artifactId>
<version>...</version>
</dependency>
<dependency> // the one for other project which I want to add as dependency
<groupId>..</groupId>
<artifactId>..</artifactId>
<version>..</version>
</dependency>
</dependencies>
但是對該項目的引用看不到這些類。 有什么特定的方法可以做到這一點,而不是從存儲庫中添加?
您可以使用<dependency>
標記內的<type>
標記來設置依賴性<type>
。
<dependency>
<groupId>..</groupId>
<artifactId>..</artifactId>
<version>...</version>
<type>jar OR war OR ejb-client OR test-jar</type>
</dependency>
類型的默認值為jar
我猜你想要這個,因為您發現依賴項所做的更改未反映在父項目中。
理想情況下,您應該遵循此
如果您想避免這種情況,請執行以下操作(盡管不推薦這樣做)
父項目->屬性-> Java構建路徑->庫->添加JAR->在同一工作區中選擇您依賴的項目->構建
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.