Search code examples
mavennetbeansjarexternal

Adding external JAR to Maven project in NetBeans


When I right click on my Maven project and choose the Add dependency option and I type my external jar's name in query, it is not found. How to add external jar to a Maven project?


Solution

  • You can follow this tutorial: http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

    Example:

    Install the jar to your local maven repository:

    mvn install:install-file -Dfile=cxf-2.7.3.jar -DgroupId=org.apache.cxf -DartifactId=cxf-bundle -Dversion=2.7.3 -Dpackaging=jar
    

    Edit the pom.xml file in your project to include the newly added dependency:

    <dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-bundle</artifactId>
    <version>2.7.3</version>
    </dependency>
    

    This should work regardless of the IDE you are using.