我已經多模塊結構Maven項目如下:如何聲明全局依賴與Maven的所有子模塊和eclipse
- 父
- 服務器
- 共享
- 客戶
對我來說,顯然我會爲所有這些項目編寫單元測試。因此,我認爲,將足夠多的增加依賴於母公司的pom.xml如下:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
,然後在每個子模塊使用它,FE:
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
但我得到的錯誤在Eclipse中像:The import org.junit cannot be resolved
當我執行Maven-> Update項目或mvn clean install
時,根本沒有錯誤。
我指的是父模塊中的孩子一個如下:
<parent>
<groupId>pl.daniel.erp</groupId>
<artifactId>erp</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
請幫
你聲明的孩子勁歌父? – Compass
我已更新後檢查它。 thx – masterdany88
嗯。我會通過:http:// stackoverflow。com/questions/3211643/maven2-sharing-dependencies-across-parent-and-children-without-redeclaring-depe如果這不是問題,請嘗試從Eclipse完全清理構建。可能是一個愚蠢的配置問題或Eclipse的行爲,需要一個完整的清潔。 – Compass