Thursday, April 05, 2012

Installing custom jar in Netbeans (Maven)

If you are developing in Netbeans with Maven build and want to include some custom jar files as dependency eg. Oracle

1) In Netbeans Maven project right-click on the "Dependencies" folder in the Projects view. Open "Add dependency" dialog
2) Make up some groupId, artifactId and version and fill them, OK.
3) Dependency will be added to the pom.xml and will appear under "Libraries" node of maven project
4) Expand the Library node. Right-click Library you want to install (will have exclamation mark) and "manually install artifact", fill the path to the jar. Jar should be installed to local Maven repo with coordinates entered in
step 2)

 

Also, note that when you execute these steps, Netbeans will issue the following mvn command behind the scenes:
mvn -DartifactId={artifact id} -DgroupId={group id} -Dversion={version} -Dpackaging=jar -Dfile={path to jar} -DgeneratePom=false install:install- file

1 comment:

Thank you for your feedback