edjm
edjm

Reputation: 5472

Can Maven build with local jars when repository is no longer available?

A few weeks back we obtained a project. The previous team is gone and we are not to be working onsite where the repositories exist. We have been given a VM of the developer VM which contains pretty much all the code. If we go onsite and run the build scripts the projects will all build, but trying to build on just the VM only some of the projects will build. The maven repository that was set up is not accessible outside of the customer location. I have been trying to get the projects to build in the VM but keep running into this message

Error building POM (may not be this project's POM)

Our lead on this project as well as myself find it nearly impossible to determine pretty much anything with these projects as things are nested within each other many levels, no useful documentation whatsoever. Good thing is we are to do a complete rewrite of the system but we still need to get the old to build in order to maintain as well as have a view as to what we are dealing with. The site is not accessible to the public so we are not able to view what is in production.

Is this issue caused by not having access to the repository?

Any suggestions on how I can get past this issue to get the build to build?

Upvotes: 0

Views: 152

Answers (1)

Stepan Vavra
Stepan Vavra

Reputation: 4044

According to this answer, it looks like it is caused by the missing dependency: fatal error - error building POM (may not be this project's POM)

In your case, I would probably do as follows

  1. Go onsite
  2. Clean local repo .m2/repository
  3. Run the build (which should go ok this time) without installing the artifacts: mvn clean package
  4. Check what appeared in your local repository .m2/repository and save it (without all the artifacts you would be able to download offsite) because you will need this later

Now, when you're offsite, you can either

  • run offline with the -o option (while all the files remained in .m2/repository) or
  • install manually (by using a script probably) all the artifacts from the .m2/repository you saved (excluding those you would be able to download) to your offsite artifacts repository (e.g., Nexus)

You might also create a single uber jar of all the required proprietary dependencies and install it as a single black hole artifact. In your poms, you would substitute all the missing dependencies with this single uber jar and you might be ok. You might get into troubles with a content of META-INF while doing this though.

Upvotes: 3

Related Questions