Konstantin Solomatov
Konstantin Solomatov

Reputation: 10352

How to rebuild dependencies before running jetty from maven

I have a multi module maven project. One of the modules is a reusable part which is packaged into a jar, and the other is a war web-app which depends on the first module. When I use jetty:run-exploded on the second module, the packaged jar is taken from local maven repository whereas I want the first module to be rebuild and packaged into the resulting war. Is there any way to force such behavior instead of the default one?

Upvotes: 3

Views: 1314

Answers (2)

Andrew T Finnell
Andrew T Finnell

Reputation: 13638

From everything I can tell from reading documents about Maven's design and using Maven myself this cannot be done in the projects own directory.

Maven will not follow module paths UP a hierarchy. Using -amd (also make dependencies) will only work at the top level module that ties all the other multi-module pom's together. So what you can do is this:

At the TOP level directory

mvn -amd -pl jetty_module jetty:run-exploded

Upvotes: 1

Chandana
Chandana

Reputation: 2638

I think you can use maven Advanced Reactor Options to archive this.

http://www.sonatype.com/people/2009/10/maven-tips-and-tricks-advanced-reactor-options/

The -pl or –projects option allows you to select a list of projects from a multimodule project. This option can be useful if you are working on a specific set of projects, and you’d rather not wait through a full build of a multi-module project during a development cycle.

Maven -amd(also-make-dependents ) also help to build multi module project once. Using that you can build a project and any project that depends on that project.

Upvotes: 1

Related Questions