0
votes

I believe that the answer will be really easy, but I haven't figure out how to do it.

The problem is:

I have a third-party project, which is being cloned from github, so I'm not going to change anything there, but I need this project for my work with MUnit.

The project is mule-interceptor-module and it has a version 3.4-M4-SNAPSHOT.

I created a build in Jenkins and I want to get mule-interceptor-module-3.4-M4-SNAPSHOT.jar after it, but Jenkins REMOVES -SNAPSHOT from the jar name and updates pom.xml with new version: 3.4-M4 instead of 3.4-M4-SNAPSHOT. The project, which uses this one (munit) in its dependencies has 3.4-M4-SNAPSHOT. So I need the SNAPSHOT in version.

What I tried to do:

I tried to build the same project on the server, which my Jenkins is installed on, using just mvn clean install and I got mule-interceptor-module-3.4-M4-SNAPSHOT.jar.

The question is:

How to tune Jenkins so that I could finally have SNAPSHOT build?

My job setup:

Jenkins Console output Jenkins Console output wirh -X

The solution:

  1. in Jenkins /Configuration/Build/Advanced check in Use private Maven repository
  2. Choose Strategy: Local to the workspace
  3. remove everything from /workspace folder by rm -R *

@Grove: thanks you a lot for the support!

3
Can you share your Jenkins job setup? I don't think Jenkins would willingly rename generated artefacts, I suspect it might be Maven related. - Morfic
Grove, I posted the update, where you can find the configuration. - Larisa
Grove, I do believe it's maven related issue, but I can't figure out how to get the behavior I want to. - Larisa
Do you have configured any release parameters? Also any chance you can attach the log? - Morfic
Looking at that pom, it looks like it should use 3.4-M4-SNAPSHOT as a suffix. Where is that 0 coming from? The only thing that says 3.4.0 is the dependency you're using. Are you sure you're looking at the right place? Maybe you're confusing the target output for a dependency it's using? What's the full file name of the jar jenkins is using? - Daniel Kaplan

3 Answers

1
votes

I can see in the logs: Your branch is ahead of 'origin/3.4.x' by 1 commit. and Building Mule Interceptor Module 3.4-M4. Could it be that your revision has 3.4-M4 as a version in the pom?

1
votes

The solution:

  • in Jenkins /Configuration/Build/Advanced check in Use private Maven repository
  • Choose Strategy: Local to the workspace
  • remove everything from /workspace folder by rm -R *
1
votes

Why are using SNAPSHOT dependency from a 3rd party ? The standard is to use a RELEASE version, right ?

Answer Anyways the fact that using the private maven repository worked for you proves just one thing, that the negative cache in your server's maven repo was causing the problem. See this Q and A from me more than a year back, when exactly the same solution worked for me, albiet for a different problem and I marked it as the answer. Only to find a few months later that I did not go to the root cause of the problem and just found a workaorund.

To test this theory, set <updatepolicy> true <updatepolicy> and use maven -U clean install. It will have the same effect as your solution of using a private repo.