Search code examples
mavenmaven-3dependency-managementnexussonatype

Local Nexus Maven repository for common java libraries


We have a Nexus install that has a collection of commonly used java dependencies (commons-codec, jodatime etc.)

The directory structure is similar to the below

commonjavalibraries
|
|_ commons-codec
| |_commons-codec
|   |_1.2
|_ commons-compress
  |_commons-compress
    |_1.3

I am in the process of adding the latest version of these dependencies to the repository.

To do this I have created a new pom and setup dependency management to deploy to Nexus.

However I now know that the groupId:artifactId:version attributes of the pom dictate how the project is deployed to nexus. Which I think would mean I'd need a separate pom for each group element.

How is the central repository pom managed? I realise it's possible to proxy the central repository, unfortunately our network doesn't allow downloading of jar's hence the need for a hosted commonjavalibraries repository in the first place.

Is there a way of doing what I'm trying to achieve without creating a pom for each group element?


Solution

  • After a bit more digging I noticed that when dependencies were downloaded from central they were stored in .m2/repositories along with their pom files.

    I wrote a Python script to copy these into another location and then walk that directory tree and run mvn deploy:deploy-file for each jar/pom pair I came across.