Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Larger number of external jars

 
sabine schilling
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

This is my first post so first of all a very big hello to every one

I work in a support team and we want to add some functionality to the core product. All of us are experienced java programmers but very new to Maven. We can link our external custom code to the core product by using its 20 odd API jar files.

In simple Eclipse project all we normally need to do is to just add them to our projects java build path -> external jar files.

But now that we are mavenising our project not sure how to go about adding all these jar files into our project pom. Do we need to add each one of these explicitly? or is there a setting in pom that allows us to create dependency on a bunch of jar files say sitting in a single folder ?

many thanks
S
 
sabine schilling
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the web I found some thing like:

<dependency>
<groupId>app-lib</groupId>
<artifactId>libs</artifactId>
<version>5.2.3</version>
<scope>system</scope>
<systemPath>C:/MavenProjects/CustomAgent/app-lib</systemPath>
</dependency>

but I keep on getting error in eclipse : Missing artifact app-lib:libs:jar:5.2.3
I guess its still looking for a jar file instead of searching in a folder for multiple jars....

Any ideas ?

 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your product build mavenized? If those jar files itself are built by maven, it will make things easier for you.
 
sabine schilling
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jayesh A Lalwani wrote:Is your product build mavenized? If those jar files itself are built by maven, it will make things easier for you.


Hi

I think they are but we are only provided a bunch of jar files so the dev process is a complete black box for us.

thanks
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18025
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All dependencies in a Maven project need a repository to live in. Unlike simpler systems such as vanilla Ant (without Ivy), Maven is not architected towards "brute-force" inclusion of jars, nor "mix and match". So all of the dependent jars must be in a maven repository. No manual jar copying.

Maven dependency jars can live in one of the following places:

A) Your local disk maven cache. Not recommended for team use, obviously

B) An internal Maven repository server(s). Nexus is a popular product for providing this. It also helps with support for snapshot builds of works in progress

C) A public Maven repository. There is the master Maven repo hardwired into Maven, plus many vendor-specific repos, such as the JBoss one.

If you have a product that isn't in a public repo such as an internal product or an unsupported third-party product (a good example are IBM's DB2 driver jars), you can catalog it in a local repo (A or B, above). To do so, you have to attach the standard Maven metadata (group and artifact IDs, version, etc.) and import it. This process is documented in the Maven docs on their website. Once placed in a suitable repo, user-added products are indistinguishable from public products from the viewpoint of people doing Maven builds.
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sabine schilling wrote:
Jayesh A Lalwani wrote:Is your product build mavenized? If those jar files itself are built by maven, it will make things easier for you.


Hi

I think they are but we are only provided a bunch of jar files so the dev process is a complete black box for us.

thanks


If they have a artifact repository, you could directly pull the jars off their maven repo. They need to tell you where you can pull artifacts from. All you need to do is configure you POM to pull artifacts from their repo, and add their group ids and artifacts ids in your POM. Maven will download the jar. You don't need to store the jars anywhere.

If they don't have a artifact repo for you to use, you can setup one yourself, and upload the jars into the repo. Every jar that is built using maven has a pom.xml file inside it that contains the groupid/artifactid of the jar and also the groupid/artifactid of all it's dependencies. When you upload it into the repo, the repo will read the pom.xml, and automatically put it in the correct place. Again, you should configure the pom to pull artifacts from your repo and put groupid/artifactids in your pom.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic