creating jar file of maven projects with netbeans

Based on @yatskevich answer, you could go to your NetBeans Project Properties > Actions and add package to the Execute Goals of the following Actions:

  • Build project
  • Clean and Build project
  • Build with dependencies
  • Plus any other you feel should also package

I did this on NetBeans 7.2.1

PS: this will create the JAR on every change you make, so choose wisely where to add package. I don't mind it building a JAR for small projects on every build.


  1. Open cmd (if you are on Windows) or any shell (if you are on Linux)
  2. Navigate to your project directory (use cd command)
  3. Run mvn clean package there.

Your jar will be in <project dir>/target.