6
votes

I have an artifact that should be built for several target platforms:

  • Linux x86
  • Windows x86
  • ARM11

Unfortunately due to the lack of crosscompilers, it is not possible to create all versions of the artifact in one go.

Using other words, the goal is to have in the repository something like this

  • artifact-1.0.0-linux.zip
  • artifact-1.0.0-windows.zip
  • artifact-1.0.0-arm11.zip
  • artifact-1.0.1-linux.zip
  • artifact-1.0.1-windows.zip
  • artifact-1.0.1-arm11.zip
  • ...

Note that the versions are in sync. How to accomplish this?

The thing is that the release process upgrades version of the pom.xml after every build. So by building consecutively on various platforms I can achieve having

  • artifact-1.0.0-linux.zip
  • artifact-1.0.1-windows.zip
  • artifact-1.0.2-arm11.zip
  • artifact-1.0.3-linux.zip
  • artifact-1.0.4-windows.zip
  • artifact-1.0.5-arm11.zip
  • ...

but this is not what I am looking for.

I could

  1. run on Linux

    mvn release:prepare release:perform -DpushChanges=false

    (with pushChanges set to false release won't increase version number in SCM)

  2. and then run on Windows

    mvn release:prepare release:perform

    (this will increase the version number)

But then the responsibility to trigger the release processes on various platforms in the proper order lies with me. Is there a way maven can help me with this?

Do you have any suggestions?

Thanks


PS. Note that this is not a question about how to organize into modules. It is about how to synchronize release processes of a single artifact on multiple platforms.

3

3 Answers

2
votes

Have you found a solution for this yet? It's good to know I'm not the only one fighting with Maven :-)

Anyway,

Are you allowed to deploy a released version to nexus? I'm thinking, you could do this:

1 - Do a "mvn release:prepare release:perform" from a windows machine - that should get artifact-1.0.1-windows.zip into nexus.

2 - Checkout the artifact-1.0.1 tag from source control

3 - Do a "mvn deploy" from linux and arm11 (whatever that is :P) - that should get -linux.zip and -arm11.zip into nexus as well.

Though, I believe that depending on how nexus is configured it won't let you redeploy anything with the same GAV (even if the classifier is different)

0
votes

As I see, you use classifiers (artifact's file name suffix) like linux, windows or arm11 to distinguish various artifact's releases, intended for specific platforms. So, if you create multi-module project managed by Maven, where modules would be artifacts with same groupId, same artifactId, same version (probably inherited from their common parent), but different classifier, you'll get exactly what you want. In such case, you always release your multi-module POM (usually it is common parent for its modules as well) to have all modules released at once. Assuming same-version-for-all-modules-policy (which seems to fit pretty well here), you can basically execute:

mvn release:prepare release:perform -DautoVersionSubmodules

and that's it. You will get artifact-1.0.0-linux.zip, artifact-1.0.0-windows.zip, artifact-1.0.0-arm11.zip artifacts released. Next development version will be set to 1.0.1-SNAPSHOT for all modules (via inheritance from parent).

0
votes

You helped me out with your question...I didn't know about the pushChanges=false option.

Using Jenkins you can set up a job on each platform that performs the maven release in series using the "Trigger builds remotely (e.g., from scripts)" feature. If you desire, you can use a Parameterized Build to choose which version to build (If you use that, then you need the Parameterized Trigger Plugin to trigger the build on the other platforms).