NetBeans = Best Maven IDE?

Today I want show what is possible with Maven 2.0.9 in NetBeans 6.5 and what makes me nervous.

First of all you have to download NetBeans and then the Maven plugin: Click Tools->Plugins->Available Plugins.

I recommend to install the command line of maven and then set the ‘connection’ to the local repository in NetBeans: Tools->Options->Miscellaneous->Maven->Local Repository should be sth. like /home/user/.m2/repository

  • Add a new jar to the project via right click or directly in the pom.xml: there you will have code completion! I.e. you can always choose the latest version of a library or easily switch versions.
  • Add javadoc or sources (download all source)

    add-sources-and-javadoc

    download-sources

  • You can search unknown class in repository

    search-unknown-symbol

    search-in-repositories

    after adding the JodaTime library with this dialog and adding the sources with the first dialog – all is fine:

    auto-added-lib

  • Set different goal to F6: right click the project->properties->actions->run project and then clear all the fields and set the ‘execute goal’ e.g. to
    mvn jetty:run
  • In the same dialog you can set skip test to true if this is necessary or if you want to speed up compilation
  • Profiling and debugging of a maven project works now, although I had some problems under vista with profiling, but under linux were no issues

So I am nearly happen with maven under NetBeans, but what really sucks is maven while compiling. A small native NetBeans project takes under 2 seconds to clean and compile. And with maven? Nearly 10 seconds!
How could one change this? I only found a workaround to use the same project as native NetBeans project, but nothing more. Any ideas how to make ‘maven install’ or ‘mvn compile’ faster??

(BTW: Today wordpress does not want that I make clickable images … if you want to see the images in better quality you have to right click them->view->remove the stuff after ‘?’. Example: https://karussell.files.wordpress.com/2009/02/add-sources-and-javadoc.jpg)

Advertisement

7 thoughts on “NetBeans = Best Maven IDE?

  1. UPDATE:
    specify working offline ‘maven -o’ to get faster maven builds!
    This is possible in NetBeans via:
    Tools->Options->Miscellaneous->Maven->Work Offline

  2. im not sure why you need to manually use mvn clean compile, for me the netbeans ide automatically compiles after Changes, so only mvn clean install (could)should be a problem 🙂

    options for maven compiler, for descriptions see http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html

    maven.compiler.optimize=false – should be true for production code ! brings the most speed up if i remember correctly
    maven.compiler.debug=false
    maven.jdk=1.6 – should not be important, but who knows if there are performance differences between JDKs

    options for maven-surefire-plugin to speed up junit tests (with testng you can run tests simultaneously)
    for descriptions see http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html

    maven.surefire.forkmode=once – especially good with spring framework, only one application context per test-class

    further possibilities

    – skip Tests
    – work offline (as you already noted) – should only be required if new plugins/artifacts are used or if additional repositories are defined (without updatePolicy=never)

  3. hmm i subscribed to email notification, no email sent..

    after some thinking it might be a difference in understanding of ‘compile’

    i mean the normal checks the ide makes on code changes, e.g. correct syntax, compatible interface changes and such, actually i dont think i ever needed ‘mvn:compile’

    anyways, i work with stock netbeans versions since 6.5 and it works with

    – 6.5
    – 6.7M2-M3
    – 6.7 Beta

    my overall ide setup

    – jdk 1.6+
    – maven 2.0.9 installed >>> that could be one of the important differences, netbeans comes with embedded maven, but due to my local installed version, netbeans uses the local and not the embedded one

  4. yes, I am using external maven as well.

    It is true that the hints are really fast, but I want to run my test cases and for that mvn compile will be invoked.
    For a native netbeans project this compile+run is really fast – not the case for maven compile+run …

    Maybe you have other suggestions?

    (“hmm i subscribed to email notification, no email sent..” -> sorry, wordpress.com should normally do this, hmmh)

  5. Pingback: Quick hit: Take Maven offline in NetBeans « Developmentality

Comments are closed.