Java dependency syncing (maven local to remote)

Creating a maven repo where we will be keeping our project dependencies.

Some of the dependencies can only be accessed via specific security details which are behind a VPN . The newly created nexus should be a place where we keep those dependencies so we can access those through jenkins. Accessing nexus which behind the VPN is not possible for the newly created nexus as the client due to prohibition from corporate IT.

The problem is the namespace in maven repository. The specifc dependecies which are in VPN is in my local maven repository (~/.m2/repository). What needed to be done is to be pushed to this in newly created nexus so we can access those dependecies during jenkins build process (e.g by using a seperate maven profile to make sure dependecies get fetched from newly created repo). To acomplish that I am listing all the artifacts via:

mvn -Dmdep.copyPom=true dependency:copy-dependencies 

And using mvn deploy:deploy-file to upload it to newly created nexus repo. But when I use mvn deploy:deploy-file to uplod the files groupid gets messed up. And as the packages are laid out by group id. And then whole process of syncing via listing the project dependecies and pushing it to remote repo feels a hack. And group id requirement makes it unsuable.

I thought about syncing the dependecies simply from my local ~/.m2/repository to the newly created nexus but not sure whether it will keep the groupid intact as while synching the local diretories will be pushed to the remote. What would be the standard approach? Can we use maven for pushing those dependencies?

BTW I am new to the maven dependency management so please free to explain if it helps to solve the problem.

submitted by /u/nickkyrickky

You might also like
Leave A Reply

Your email address will not be published.