Maven/Eclipse – Adding New Jar

Adding a new jar to a maven/eclipse project:

  • Say you want the latest Rhino JavaScript jar (js-1.6R7.jar).
  • Notice that the “POM Dependency” section of the artifact page shows you exactly what you need to copy & paste into your project’s pom.xml file.
POM Dependency
--------------------------
<dependency>
    <groupId>rhino</groupId>
    <artifactId>js</artifactId>
    <version>1.6R7</version>
</dependency>
  • Once you have updated your pom, execute the following maven command to bring the jar, and optionally the source, into your eclipse project.
C:\project\workspace\project> mvn -DdownloadSources=true eclipse:eclipse

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply