Maven: Not Building But Running

Vinicius Senger (one of the developers of jHome, which won a Duke's Choice Award at last year's JavaOne) asked this question on Twitter:

I asked Jesse Glick, who works on the NetBeans Maven support, the above question and he responded as follows: 

Assuming a jar-packaging project is being referred to, you can remove <goal>process-classes</goal> from the 'run' action in nbactions.xml. In my tests, this can shave around 500msec off the time to run a small project. Of course, then you are obliged to build before running, which is much slower than just clicking Run immediately after making your modifications and having it perform an incremental build during the same Maven process.

Having the IDE detect that you have done a build "recently enough" and omit certain goals from a subsequent Maven run would be complicated and probably never work reliably.

Much faster than any of these options is enabling Compile on Save mode for application run, which is the default in NetBeans 7.2; this bypasses Maven altogether for the basic edit/compile/run/debug workflow.

The question is also answered on the related mailing list:

http://netbeans.org/projects/projects/lists/maven-dev/archive/2012-04/message/88

Comments:

... or you can always define a custom goal, that is accessible from the contextual menu of the project. For instance, I have a menu item just running the goal nbm:run-platform for Platform projects, which doesn't build anything. I also have similar stuff for (re)starting jetty in web projects (I don't have plain JSE projects at the moment, but the same stuff should be doable for the exec:java goal).

Posted by Fabrizio Giudici on April 21, 2012 at 03:39 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
24
25
26
27
28
29
30
   
       
Today