How can I speed up Maven and Netbeans

I have a rather large project (with a rather large stack, including Spring and Hibernate), which I create through Netbeans using Maven.

Unfortunately, every time I make changes to a class, I need to rebuild. It means

  • Save everything and compile
  • Run all tests
  • Build a mass war
  • Undeploy of Tomcat
  • Redeploy from Tomcat
  • Launch the application (Spring = Zzzzzzz / Hibernate = Zzzzzzz)

It may take up to 5 minutes to check if a small change has changed. Maybe I have the wrong approach?

Please advise...

+6
source share
3 answers

Well, I am also working on similar settings, so here are my 2 cents.

First of all, put your feet on the Maven-Jetty Plugin. Make him check the files for changes so that you do not have to rebuild / deploy the entire project for each change. Also, configure it to store the session so that with each (automatic) deployment you do not need to correspond and go to the state you were in before making changes:

<plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.24</version> <configuration> <stopPort>9669</stopPort> <stopKey>myapp</stopKey> <!-- Redeploy every x seconds if changes are detected, 0 for no automatic redeployment --> <scanIntervalSeconds>3</scanIntervalSeconds> <connectors> <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> <port>8080</port> <maxIdleTime>60000</maxIdleTime> </connector> </connectors> <webAppConfig> <contextPath>/myapp</contextPath> <sessionHandler implementation="org.mortbay.jetty.servlet.SessionHandler"> <sessionManager implementation="org.mortbay.jetty.servlet.HashSessionManager"> <storeDirectory>${project.build.directory}/sessions</storeDirectory> </sessionManager> </sessionHandler> </webAppConfig> </configuration> </plugin> 

Now go to the Properties project (by right-clicking the project)> Build > Compile > Compile on save and select For both application and text execution .

Also go to Options > Miscellaneous > Maven > and check / select Skip Tests for any build executions not directly related to testing so that the test runs only when you actually run the "Test".

By following these simple steps, I can quickly and error-free copy and test the changes without requiring redeployment. However, I ran into a few minor issues / troubles:

  • You still have to clean assemblies when something doesn’t work (for example, you deleted something and the changes are not reflected)

  • Keeping up the running time can result in a PermGen exception (out of space), which is reasonable and you can always increase memory with jvm opts

  • you will hate to develop / test projects on containers like jboss / websphere as soon as you get used to this setting

+5
source

Give JRebel a try. http://www.zeroturnaround.com/jrebel/

BTW I don't get paid zt - just a satisfied user.

+2
source

Why do you need to run tests with every change? This is a huge cost with minor changes. Disable it using -DskipTests = true

Take a look at: http://wiki.netbeans.org/HotDeploymentWebApplicationWithMaven

Also install Netbeans for quick deployment on Tomcat (use Jetty). See This Post: Incremental Hot Deployment on Tomcat with Maven and NetBeans .

+1
source

All Articles