Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Including Local Jar Files

 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have some jar files those are not part of any global repos, i have to include them in my war thats build by Maven, on some googling i found following task



but this does not put the jar file in war...also its not recommended solution, does any one have better way to achieve this?

-P
 
Joachim Rohde
Ranch Hand
Posts: 433
Netbeans IDE
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what I do. I add the dependencies to my pom.xml and run mvn. I then get an error about the missing dependencies along with the full command needed to register the JAR files in my local repository. I enter those commands, the JARs go into the local repository and then I run mvn again and everything compiles.

The easy part is coming up with a reasonable mechanism for specifying the group id (I usually use the first few levels of the class package), artifact id (I used the library name) and version in the dependency. The hard part is that you have to manually handle transitive dependencies (aaa.jar depends on bbb.jar, but the app needs only aaa.jar to compile).
 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks much Peter and Joachim, I am good now.

-P
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic