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 ?
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.
An IDE is no substitute for an Intelligent Developer.
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.
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.
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.