Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
278 views
in Technique[技术] by (71.8m points)

How to compile dependency in maven?

Scenario:

I have a main level project A and within A , two child projects B and C worked on by different developers , but they agree on the abstraction through common interfaces.

B depends on C (dependency). In B's pom I added

<dependency> .. details of project C..</dependency> .

Doing this, maven inserts the dependencies fine except that project C is not recompiled.

I want project C to automatically re-compile every time I compile B.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you want to build B and automatically build it's dependencies you can use the advanced options of the maven reactor like –-also-make-dependents .

mvn clean install –-projects B –-also-make 

Or short

mvn clean install -pl B -am

That will compile all submodules of A whose B depends on . There are a useful post on sonatype blog on the advanced options of maven reactor. http://www.sonatype.com/people/2009/10/maven-tips-and-tricks-advanced-reactor-options/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...