0
votes

I am in a situation where I have one Build Server box which is to carry out all continuous integration and manage our maven repository. The box works as follows:

  1. There is one maven repository which is hosted through Apache Server as a URL for developers to use
  2. All Jenkins jobs (including release jobs) run mvn install so that artifacts are kept in this one repository.

I would like to get rid of the Apache server and run Nexus on this same box to manage and host repositories, however I have the following questions/ideas:

With Nexus and Jenkins on the same box, will it mean that I will have to manage two repositories, one where maven installs an artifact to a local repository, and one where maven deploys an artifact to nexus? Would it be possible to have Nexus manage the "mvn install" repository also? How can I make sure we don't run out of disk space on the server very very quickly all the time?

Thanks

Added as response to comments: Thank you both, I am thinking I will just set the Jenkins jobs and release plugin goals to mvn package deploy:deploy in order to skip the install phase, that way, artifacts go directly from the target directory to Nexus. However I guess the Jenkins job will require a local repository from which to use depedencies which will get copied from Nexus to the maven local repository during the build, I am not sure if this can be avoided though.

2

2 Answers

0
votes
  • mvn install installs in the local repository
  • mvn deploy installs to the remote repository

these semantics are defined in the lifecycle and map to different plugins. Their implementations are different.

You don't have to manage the local repository. Actually for some if not most jobs you might even want to define it localized to the job (with the 'Use private Maven repository' option) instead of to the user who is running the job, especially that you plan to use nexus for repository.

You will have to change your jobs to use mvn deploy instead.

0
votes

How can I make sure we don't run out of disk space on the server very very quickly all the time?

Configure Jenkins/Nexus. Discard old builds and disable automatic artifact archiving. Both settings can be found in the Jenkins job-configuration. Also you could delete old artifacts automatically from Nexus using Scheduling Tasks.

There is no need to install the artifacts into the local maven repository when using Jenkins/Nexus on a dedicated server.