rybit
rybit

Reputation: 756

Setting up a maven project for already made jars

I have some jar files that I need to include in my build - I'd rather not specify them as system dependencies - that creates a nightmare for setup. I have been uploading them to artifactory and then they can be pulled down directly, but I won't always have access to artifactory while building.

What I was thinking of doing is creating a project that has these jar files in them. It could be one per or all of them (open to suggestion). I was wondering if there is a graceful way to handle this?

What I have done (which is clearly a hack) have a project that takes the jar and during the compile phase it unpacks the jar into the target/classes directory. It then packs those class files back during the package phase. it essentially creates the same jar file again...massively hackey. Could I add the jar into the resource area or is there a different project type I could use? I am open to any ideas.

Upvotes: 2

Views: 73

Answers (1)

Alex Gitelman
Alex Gitelman

Reputation: 24722

You may try to use install:install-file. I would go about it in the following way.

  • Create project that contains all your jars in some location
  • Configure install:install-file in pom of this project to install jars in repository in some early phase.
  • Make sure that this pom is executed before anything else that depend on it. List it as first module.

Upvotes: 3

Related Questions