Вопрос

we are currently migrating from maven2 to maven3. Now we have a problem with the new "SNAPSHOT" policy of maven3 in one of our shared projects. The project provides different configuration using filters to set different setting for different environments (dev, int, production) which are devided throw classifier.

In our Jenkins buildserver produces and deploy this three classifier in our local company repo: The dev in the main maven goal, the others as post steps.

In maven2 this was no problem, because after the deployment we had in our repository:

  • artifact-1.2.0-SNAPSHOT-dev.jar
  • artifact-1.2.0-SNAPSHOT-int.jar
  • artifact-1.2.0-SNAPSHOT-prod.jar

With maven3 we have now this timestamped versions:

  • artifact-1.2.0-20140212.103043-1-dev.jar
  • artifact-1.2.0-20140217.174231-2-int.jar
  • artifact-1.2.0-20140311.125512-3-prod.jar

Now the build of the other projects with the classifier dev or int breaks, because the lastest SNAPSHOT version is the 3rd one (prod) and the dev and int cannot be resolved from our repository.

As far as I know it's not possible to tell maven3 to deploy the "good old" SNAPSHOT without a timestamp. Is there a solution to process all configuration inside one maven3 call? Or how can we configure Jenkins to do that all as "one SNAPSHOT"?

Thanks in advance

Update 1

As followed the Post steps are configured:

Maven Goals:

  • Maven Version: 3.1.1
  • Goals: clean deploy -Pint

Maven Goals:

  • Maven Version: 3.1.1
  • Goals: clean deploy -Pprod
Это было полезно?

Решение

This won't work as you have planned. As you said, there is no way to use non timestamped repositories in Maven 3.

You have two options:

  1. Either adapt your build in a way that creates all classifiers in one build (possibly by using different modules instead of different classifiers)
  2. Or create a your own deploy mechanism.

I would strongly recommend solution 1.

Другие советы

From my understanding the artifacts generated from Maven 3 are coming with timestamp in their name like artifact-1.2.0-20140212.103043-1-dev.jar which are causing the failure of dependent builds.

As you need Maven 3 to generated artifacts with naming convention artifact-1.2.0-SNAPSHOT-dev.jar , this can be achieved by using "finalName" tag in the corresponding POM.xml which are generating these artifacts .

Controlling maven final name of jar artifact

Regards

Jyotsna

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top