JavaFX and Maven

There is a post which discusses all the details about how to set up JavaFX in a maven project (compiling etc).

For my timefinder project I only need a solution where I can use a JavaFX-jar within my maven project. This is a little bit faster to achieve:

  1. First, be sure you set up JavaFX correctly. For linux and JavaFX 1.1 you can try this.
  2. Now write the following in your /home/user/.m2/settings.xml:
                <!-- linux -->
                <!-- windows
                    <javafx_home>C:\Program Files\NetBeans 6.5\javafx2\javafx-sdk</javafx_home> -->
  3. After this you can include the javafx libraries in your pom.xml:
            <!-- The javafx dependencies are taken from the profiles/ file-->
  4. That’s it! Now you should be able to use javafx or javafx-components in you fancy application. In the most cases you might be interested in one of my previous posts, which discusses how to embed a javafx-component into an existing Swing-application.

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)



  • You can search unknown class in repository



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


  • 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:

Maven2. Phases vs. Goals

What is the difference between phases and goals in maven?

I would like to explain the difference with an example:

Imagine you need an ant task (like copying files) and you want to do this task on every call of

mvn install

For this it is necessary to bind the goal ‘run’ from the maven-ant plugin to the phase ‘install’ of the maven lifecycle:

                    <copy file="fromfile" todir="todirectory" />