Question

Problem: 20 different JAVA projects with a lot of inter-dependencies. Every time there is a bug fix after code-lock, we have to release a bunch of artifacts as needed depending on which artifact changed. For example, if artifact 3 had an unlock and needed a bug fix, we will need to release (using maven release plugin) projects 3,4,5,6,7 and 10 (because 4,5,6,7 and 10 are dependent on 3). Co-ordinating between teams to get this task done takes time. Plus building each artifact takes a good 20-40 min.

We want to shorten this process. We are thinking of the following:

  1. Use snapshots for artifacts with time-stamps
  2. Promote individual artifacts to repository using jenkins jobs and tag svn.
  3. Update dependencies using mvn version:set command for each project that needs the dependency.

Has anyone implemented a solution similar to as described above? If so, what issues did you run into?

Any other suggestions that will not rebuild the artifacts and allow us to release 15-20 artifacts at a click of a button will be helpful :)

Was it helpful?

Solution

Unfortunately you have to rebuild your artifact if you change your pom file. Otherwise your state in your VCS does not represent the state your are working with.

Lets make an example. Project A, Project B where B dependends on A:

Project A: pom.xml

   <version>1.0-SNAPSHOT</version>
   Some dependencies etc. 

Project B: pom.xml

   <version>1.0-SNAPSHOT</version>

   Some dependencies etc. 
   <dependency>
     <groupId>project.a</groupId>
     <artifactId>A</artifactId>
     <version>1.0-SNAPSHOT</version>
   </dependency>

Now you build Project A and B. The state in your repository represents the states of the pom files with their state/dependencies to SNAPSHOT.

Now you will change Project A to make "release" from it but you don't rebuild your artifact. Than the following is in your version control and may be you do a tagging of it.

Project A: pom.xml

   <version>1.0</version>
   Some dependencies etc. 

Second you do the same with Project B: Project B: pom.xml

   <version>1.0</version>

   Some dependencies etc. 
   <dependency>
     <groupId>project.a</groupId>
     <artifactId>A</artifactId>
     <version>1.0</version>
   </dependency>

But you don't rebuild your aritfact either. The result is your repository does contains artifacts which represent the state of the SNAPSHOT but your version control says something different. This is only very simple example of the problem. If you have more projects etc. the worse the thing will become.

Furthermore i would recosinder thinking about changing the project structure, cause based on what you've written about the dependencies it looks like those project should be released together so it might a good idea to create a multi-module build out of them.

Furthermore the rebuilding can be done by using appropriate jobs in Jenkins which can handle dependencies or you might consider using build pipeline plugin to handle such things.

But one other questions comes to my mind: Why do your builds take so long? You might investigate why they are taking so long and reduce the release time over all.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top