例如,我有一個遊戲項目:如何讓Maven在子模塊目錄中運行mvn時找到兄弟模塊?
superegg/
|- game/
| `- pom.xml -> (a lot of jars.)
|- ai/
| `- pom.xml
|- sprite/
| |- egg/
| | `- pom.xml -> sprite
| |- badguy/
| | `- pom.xml -> sprite, ai
| `- pom.xml -> game
` pom.xml
(這裏指-->
取決於)
所有子模塊的快照版本,並且不安裝它們,也不部署。
現在,我想內badguy/
做一些事情:
.../sprite/badguy/ $ mvn exec:java ...
然而,行家試圖代替../../game
和../../ai
從Maven倉庫找到依賴sprite, ai
。
如何使項目目錄中的Maven解決子模塊依賴關係?
我不安裝它們,因爲有太多的子模塊(儘管這裏沒有列出),完全編譯/安裝過程需要很長時間)。我也試過但沒有成功:
superegg/sprite/badguy/ $ mvn --reactor dependency:build-classpath
[INFO] Cannot execute mojo: build-classpath. It requires a project with an existing pom.xml, but the build is not using one.
superegg/ $ mvn -pl sprite/badguy dependency:build-classpath
Missing dependencies: ...
superegg/ $ mvn --reactor -pl sprite/badguy dependency:build-classpath
Project 'some-module' is duplicated in the reactor
順便說一句,我可以建立從superegg整個項目/沒有問題。
IntelliJ很棒,但我無法在ssh/telnet中運行它。 – 2011-05-24 01:20:04