Find and replace jar file with Maven

Suppose you are working on a large project that runs on some application server (say, Tomcat, but it could be Jboss or Jetty or something else). The project consists of several wars, while in each war there are many pitchers. All of this is built using Maven, and it takes a long time to create it.

Now suppose that a developer makes changes to only one module, which creates one small jar. To continue working and test the change, the developer needs to replace this bank in the corresponding wars and restart the server (sometimes this is enough to redeploy the wars). This is much faster than restoring the entire application. I have seen many developers (including myself) create shell scripts for this task.

However, it can be much better if it can be done automatically using maven. Say, when you run "mvn install", the plugin will also go to a specific predefined location (for example, $ {tomcat} / webapps) and will look for all myjar.jar visibility and replace it with a new version (we have several cans, remember?)

Does anyone know about such a plugin? Or maybe some other tool that can perform the same task? Or a little better how to do it?

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

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

+4
source share
4 answers

Well, any functions that I asked in this question, I implemented myself. See http://code.google.com/p/replace-file-plugin/ I will be grateful for any feedback.

+2
source

Check out JRebel . It is amazing, it significantly reduces development / deployment time. There is a 30-day free trial, so check it out for free. I bought my license, it took me several weeks to approve its purchase, and I could not wait.

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

+2
source

If you can write a script as an Ant construct, you can use the Maven Antrun plugin to insert Ant build the build life cycle.

0
source

Let me limit the scope to one and only military file, I think you can easily throw this into your script.

You can try this option: create the final build module, which works quickly and combines all the dependency modules into a single war file. Then, if you are initially installing mvn clean package for the entire assembly, you will need to mvn clean package to install the modified dependency module and re-run the final assembly module in order to quickly access the updated war. This is a very robust construction scheme (and therefore error prone), but after you are familiar with this approach to changing distribution, you will probably think that this is the simplest idea that can work and work faster.

0
source

Source: https://habr.com/ru/post/1344984/


All Articles