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.
IDRsolutions develop a Java PDF library, a PDF forms to HTML5 converter, a PDF to HTML5 or SVG converter and a Java Image Library that doubles as an ImageIO replacement. On the blog our team post about anything interesting they learn about.