Question

Suppose you are working on a big project, which is run on some application server (let's say Tomcat, but it may be also Jboss, or Jetty, or something else). The project consists of a several wars, while each war contains a lot of jar. The whole thing is built using Maven and it takes a lot of time to build it all.

Now, suppose a developer makes a change in just one module that produces one small jar. To continue working and test the change, the developer needs to replace this jar in the relevant wars and restart server (sometimes it's sufficient to redeploy wars). It's much faster then rebuilding the whole application. I have seen a lot of developers (including myself) creating shell scripts for this task.

However, it could be much nicer, if it could be done automatically using maven. Let's say when running "mvn install" the plugin will also go to some predefined location (e.g. ${tomcat}/webapps) and search for all appearances of myjar.jar and replace them with a new version (We have multiple jars, remember?)

Does anyone know about such a plugin? Or may be about some other tool that can do the same task? Or some better idea how to do it?

Updated: Btw, If I don't find a solution, I'll probably implement it myself. So please let me know if you are interested. I'll need some beta testers :)

Updated: So I created the plugin myself. See http://code.google.com/p/replace-file-plugin/ Any feedback is appreciated.

Was it helpful?

Solution 2

Well, any features I asked for in this question, I have implemented myself. See http://code.google.com/p/replace-file-plugin/ I'll appreciate any feedback.

OTHER TIPS

Check out JRebel. It rocks, reduces development/deployment time a lot. There is a 30 day free trial, so check it out for free. I purchased my own license, it took my company a few weeks to approve purchasing it, and I couldn't wait.

Seriosuly man, it rocks. Read about it, it can do what you want.

If you can write your script as a Ant build, you can use the Maven Antrun plugin to embed the Ant build in your build lifecycle.

Let's narrow the scope to one and only war file, I think you'd scale this up to your scenario yourself with no trouble.

You may try this option: create a final assembly module which runs fast and combines all dependee modules into one war-file. Then, if you initially do mvn clean package install for the whole build, you'd have to mvn clean package install the changed dependee module and re-run the final assembly module to quickly get grab on the updated war. This is quite stateful build scheme (and thus error prone), but after some getting familiar with this approach to change propagation you'd probably think this is the most simple idea that might work, and work faster.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top