At IDR Solutions I spend a lot of time on working on the development of our Java PDF Library. Recently, I have been working on converting our JavaFX NetBeans plugin from Ant build to Maven Build. Click here to read why we converted from Ant to Maven.
For this tutorial, I will create a simple NetBeans plugin with an Action that pop’s up a ‘Hello NetBeans Plugin’ when clicked.
Before we convert this project to maven, we have to be aware of the Maven Directory structure and where which file should be placed.
Lets have a look at the image of this Maven Project Below.
So Let’s Start Converting
First of make a zip copy of your Ant project so you can always go revert back. In NetBeans, lets create a new Maven Plugin Module, this time i will call it TestMavenXX change the Group ID to the code base name of your Ant Plugin and click next and Finish.
You can now copy and paste all non java files excluding Bundle.properties from TestModule/src/org/yourcomp/testmodule to TestModuleXX/src/main/resources/org/yourcomp/testmodulexx
At this stage we can delete the TestMaven Project.Once done Right click on TestModuleXX in NetBeans and select Rename. You can Rename it to TestModule now.
Now do a Clean and Build on your project. If you get an error like this
Project uses classes from transitive module org.netbeans.api:org-openide-util:jar:RELEASE80 which will not be accessible at runtime.
Check in the imports of your java classes you should see a yellow triangular sign on one or more of your imports.To fix the problem,we need to add this module as direct dependency in our pom.xml. Once done you should see the triangle disappear.
Hopefully you have found this quick guide useful.
Latest posts by Ernest Duodu (see all)
- 10 things Developers should know about Windows 10 - September 15, 2015
- How to test your Java Application using PMD, and Jenkins - July 30, 2015
- Setting up Continuous Testing with Jenkins - July 23, 2015
- How to Build Java Projects with Apache ANT - July 21, 2015
- How to upload your Java artifact to Maven Central - June 30, 2015