J Fabian Meier
J Fabian Meier

Reputation: 35795

Put Maven plugins in nexus repository

I would like to set up a Maven repository with Nexus, which is NOT connected to Maven central (due to company policy).

Now Maven tries to download a lot of plugins when I start it: All downloads fail because I am not connected to Maven central.

Is it possible to either put the plugins into my Nexus repository or install Maven with a reasonable set of plugins?

Upvotes: 0

Views: 2775

Answers (2)

Manfred Moser
Manfred Moser

Reputation: 29912

If you want to have a manually managed and provisioned repository you will have to provision the needed dependencies and plugins first.

You can e.g. do that with my Maven Repository Provisioner.

Or you could provision a Nexus repository by running a bunch of builds connected to the Central repository and then take it offline after whatever is needed was proxied.

Another, much better solution would be to use a policy-based approach and use Nexus Firewall.

You might also be interested in the problems of the manual provisioning approach. I blogged about this at http://blog.sonatype.com/2013/10/golden-repository/

In either case you are going to have to set up and configure your Maven settings.xml so that dependencies of your plugins and your projects are not mixed up.

And don't forget, Maven relies on a repository for plugins, plugin dependencies and your project dependencies. All of these have to be available.

Upvotes: 2

michaldo
michaldo

Reputation: 4599

I feel inconsistency in your needs: Nexus is mirror. Maven central is face. Nexus content is reflection. You want reflection without face. That is impossible.

But answer must be positive. I offer two options.

Practical:

  1. Plug Maven central to Nexus (add face to mirror)
  2. Build app: it will feed Nexus with plugins (catch reflection)
  3. Unplug Maven central

Scientific:

  1. Call mvn dependency:resolve-plugins. You should get several messages like

[WARNING] The POM for org.apache.maven.plugins:maven-clean-plugin:jar:2.5 is missing, no dependency information available

  1. Add plugin artifact to Nexus (as said, it is not a problem)
  2. Repeat step 1 until all plugins are resolved

Upvotes: 3

Related Questions