I'm using Intellij Idea 12 and have a multi module maven project.
To make it simple let's assume that I have:
I know Intellij has it's own build mechanism for maven projects so when I build a WAR for the first time and deploy it to Tomcat generally all works as it should. The problem start when you need to make changes in one of the sub modules, for example Module A and rebuild the War (rebuild Module C)
Intellij as it seems uses the old Module A jar that was previously build and ignores any changes I made in Module A when making/building Module C.
The only way I found to solve this is to run a Maven build on Module A and B and initiallly build the WAR with Maven and deploy it as external source.
The problem is that I have 10 WARs I want to deploy and more then 20 sub modules that compiled to jars. It doesn't make sense to rebuild all wars when I'm only want to see the changes I made in one of sub modules that affects one WAR. And sure doesn't make sense to build them externally with command line while paying for Intellij Ultimate license (so I can work with Application servers)
Now comparing this behavior to other IDE 1. Netbeans works with maven projects naturally via Maven and all builds/deployments and such are done with Maven and not by some internal mechanism. 2. Eclipse does the same with it's internal mechanism but all JARs are updated when WAR project are rebuild. (Or some other magic that works)
Is there a way work differently with IDEA or there isn't ?
Eventually I found a hybrid solution for this: Things to be done before Tomcat is run:
This is how I start Tomcat.
Detailed information:
Create 3 Maven run configurations
1.1 Clean all projects 1.2 Build all projects with JAR artifacts. You need to manually include all your projects with the '-pl' maven option. Optionally you can run "Maven clean" before launch of this configuration (look at screenshot) 1.3 Compile all Projects with WAR artifacts - No packaging with Maven
Create Tomcat configuration to Build War artifacts and include other configurations to run before Launch
Now when Tomcat is run it is possible to hotswap code changes (if JVM allows) or simply restart server to include all your new code/changes. The draw back of this is somewhat longer start time of Tomcat. That's something we are willing to live with..... For now
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With