Shurmajee
Shurmajee

Reputation: 1047

taking care of dependencies while creating a jar file

I have created a package that is to be used by other programmers by importing in their code. my programs use other jar files for XML parsing and I don't want others to worry about the dependencies what is the best way to make sure that my jar files always gets its dependencies?

  1. Should i include the dependencies in my original jar?
  2. Is there any alternative way?

Upvotes: 0

Views: 102

Answers (3)

mattis
mattis

Reputation: 119

  1. If you want to release your source as a zip archive, I would keep the dependencies outside the project jar. For example in a folder name lib.

  2. I would use a build tool like Maven (http://maven.apache.org) to manage my dependencies. It's pretty easy to set up a repository like Nexus (http://www.sonatype.org/nexus) where your team members can get your jar and all the required dependencies.

Upvotes: 1

Audrius Meškauskas
Audrius Meškauskas

Reputation: 21778

Use jarjar, seems doing exactly that you want, does not force your potential users to use exactly Maven (some may use old Ant scripts or IDE features to add .jar file directly).

Upvotes: 0

Deepak Singhal
Deepak Singhal

Reputation: 10876

I would say cleanest solution is to use bulid scripts like using Ant or Maven. In Maven you could create a local repository with the name of mayank. Now, all your team members just need to include dependency mayank; all other dependencies will automatically be downloaded. They dont have to worry about anything else.

Upvotes: 2

Related Questions