views:

18

answers:

1

Hi,

I have a multi module web project. Four modules of the project are packaged as jar and added as dependency to the fifth module, which is packaged as war. When it is time to deploy the application i just run package on the war project and my war is created with all the dependencies.

Now there is a problem.

One of the my module have heavy changes. Now when i created war for my projects these changes was not reflected in the output war file(the jar in lib folder of war has still the old code).

Can you please point the things i am missing from the release process? Why the old code is being packaged with the war?

Can you please point some good resource for real file build process using maven?

Regards, Vijay

+1  A: 

When it is time to deploy the application I just run package on the war project and my war is created with all the dependencies. (...) One of the my module have heavy changes. Now when I created war for my projects these changes was not reflected in the output war file(the jar in lib folder of war has still the old code).

You need to run a "reactor build" i.e. to run maven on all modules by launching it from the aggregating parent. Let's say you have the following structure:

parent
|-- module1
|   `-- pom.xml
|-- module2
|   `-- pom.xml
|-- module3
|   `-- pom.xml
|-- module4
|   `-- pom.xml
|-- webapp
|   `-- pom.xml
`-- pom.xml

And assuming you defined <modules> in the pom of the parent:

<modules>
  <module>module1</module>
  <module>module2</module>
  <module>module3</module>
  <module>module4</module>
  <module>webapp</module>
</modules>

Simply un package from the parent directory:

cd parent
mvn package

Maven will read all the <modules> and build them in the correct order based on dependencies.

Have a look at Maven Tips and Tricks: Advanced Reactor Options for an illustration of reactor builds and more advanced options. You could for example invoke maven like this to build the webapp module and its dependencies (but only its dependencies, not all modules):

mvn -am -pl webapp
Pascal Thivent
thanks Pascal. I have tried this and find it working. Thanks it solves my problem.
vijay.shad