Alternative Maven Release

Problem: 20 different JAVA projects with many interdependencies. Every time an error is fixed after code is locked, we must release a bunch of artifacts as needed, depending on which artifact has changed. For example, if artifact 3 had an unlock and needed to be fixed, we would need to release (using the maven plugin) 3,4,5,6,7 and 10 (since 4,5,6,7,7 and 10 depend on 3) . Coordination between teams takes time to complete this task. Plus, the creation of each artifact takes 20-40 minutes.

We want to shorten this process. We think about the following:

  • Use snapshots for time stamped artifacts
  • Contribute to individual artifacts in the repository using jenkins jobs and tag svn.
  • Update dependencies using the mvn version: set a command for each project that needs a dependency.

Has anyone implemented a solution similar to the one described above? If so, what problems have you encountered?

Any other suggestions that will not restore artifacts and allow us to release 15-20 artifacts with one click of a button will be useful :)

+4
source share
1 answer

Unfortunately, you need to rebuild your artifact if you modify your pom file. Otherwise, your state in your VCS will not represent the state you are working with.

Let's make an example. Project A, project B, where B depends 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 create projects A and B. The state in your repository represents the states of the pom files with their state / dependencies for SNAPSHOT.

You will now modify Project A to make it "free" from it, but you are not restoring your artifact. The lower your version control, or maybe you flag it.

Project A: pom.xml

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

Secondly, 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 also do not restore your artifact. As a result, your repository contains artifacts that represent the state of SNAPSHOT, but your version control says something else. This is a very simple example of a problem. If you have more projects, etc., the worse it will be.

In addition, I would change my mind about changing the structure of the project, because based on what you wrote about the dependencies, it looks like this project should be released together, so it would be nice to create a multi-module assembly from them,

Alternatively, rebuilding can be done using the appropriate jobs in Jenkins that can handle dependencies, or you can use the assembly of the pipeline plugin to handle such things,

But another question comes to my mind: why have your builds taken so long? You can explore why they take so long and shorten release time at all.

+2
source

Source: https://habr.com/ru/post/1447115/


All Articles