a·gen·tic a·gil·i·ty

Maven release prepare fails with detected changes in Jenkins

Explains how to fix Maven release prepare failures in Jenkins with TFS by using .tfignore files to exclude generated files like release.properties from source control.

Published on
4 minute read
Image
https://nkdagility.com/resources/gtoRjWgSmKe
Subscribe

If you are using Team Explorer Everywhere 2012 or 2013 your Maven release prepare fails with detected changes, however it worked when you were using SVN.

As you may have noticed I have had a few posts on Jenkins integration with TFS recently. My current customer is migrating away from SVN and Jenkins to TFS 2012 to take advantage of the cool ALM feature however we need to stage in, taking one thing at a time. They have quite a few builds in Jenkins and moving them will take time. The idea is that we can move all of the source over and it is a fairly simple process to re-point Jenkins and Maven to TFS. This allows the teams to take advantage of relating their Source and Work Item while allowing us to create parallel builds and validate the output.

Maven release prepare fails with detected changes in Jenkins

Our initial problem was around Configuring Jenkins to talk to TFS 2013 and then Mask password in Jenkins when calling TEE . As with all migration projects you get past one problem and get hit by another. The next issue was that the Release builds would always fail. Looking at the logs it is obvious why.

 1[INFO] Command line - /bin/sh -c cd /appl/data/ci-test/jenkins/jobs/TFS-TestProject/workspace && tf status -login:username,********** -recursive -format:detailed '$/main/VisualStudioALM/JavaTestProject'
 2[DEBUG] line -
 3[DEBUG] line --------------------------------------------------------------------------------
 4[DEBUG] line -Detected Changes:
 5[DEBUG] line --------------------------------------------------------------------------------
 6[DEBUG] line -$/main/VisualStudioALM/JavaTestProject/release.properties
 7[DEBUG] line -  User:       Martin Hinshelwood (MrHinsh)
 8[DEBUG] line -  Date:       22-May-2014 14:33:52
 9[DEBUG] line -  Lock:       none
10[DEBUG] line -  Change:     add
11[DEBUG] line -  Workspace:  Hudson-TFS-TestProject-MASTER
12[DEBUG] line -  Local item: [zsts490716.eu.company.com] /appl/data/ci-test/jenkins/jobs/TFS-TestProject/workspace/release.properties
13[DEBUG] line -
14[DEBUG] line -0 change(s), 1 detected change(s)
15[INFO] err -
16[DEBUG] Iterating
17[DEBUG] /appl/data/ci-test/jenkins/jobs/TFS-TestProject/workspace/release.properties:added

Here the release build is checking for changes after a get to validate the output and it finds a “release.properties” file sitting there. Now in the days of Server workspaces where you had to explicitly check out from the server you would not even see an issue. The file would not even be detected let alone pended to the server unless you ran a specific command. In the wonderful world of Local workspaces where changes to local workspaces are detected automatically this is an issue.

We need some way to tell TFS that we want it to ignore these release.properties files. Well, the TFS team thought of this and have added .tfignore files that operate just like the .gitignore one that you might be used to. However adding a .whatever files does not seem to be very easy in Widnows.

Maven release prepare fails with detected changes in Jenkins

My first attempts to add the file resulted in a “you must type a file name” error and no matter what I did I could not get that .tfignore file created. I headed to the internet and eventually found that while you are blocked in Explorer you can open notepad and save a file of the required name. That’s a little poopy but needs must. I guess only power users really need to create files that begin with a dot and this protects the rest of them.

Maven release prepare fails with detected changes in Jenkins

So we create and add a .tfignore file with a line that matches the pattern we want to ignore. Just listing the explicit file name will result in all instances, recursively, being ignored.

1######################################
2# Ignore all release files from Maven release process
3release.properties

You can get quite complicated with this file but here I have very simple needs. To get the file into TFS the easyest way is to go to the folder where you want it in your local workspace and add it to the file system. We then need to right click in the empty space of the folder and select “Add Files to folder” which will pop the “Add to Source Control” dialog above with any files listed that it can’t see already. If you have the Power Tools installed you can also just right-click the file and add it to source control right from Windows explorer.

Maven release prepare fails with detected changes in Jenkins

There may be other files that you need to ignore and I ended up with:

1######################################
2# Ignore all release files from Maven release process
3release.properties
4*.releaseBackup
5target/

All we need to do now is execute a new build and see that light turn green. This is however a “dry run” build and we still have some work to do to get the rest of the process working, however this is progress. At least I don’t have generated files ruining my day.

Troubleshooting Software Development
Subscribe

Related Blog

Related videos

Connect with Martin Hinshelwood

If you've made it this far, it's worth connecting with our principal consultant and coach, Martin Hinshelwood, for a 30-minute 'ask me anything' call.

Our Happy Clients​

We partner with businesses across diverse industries, including finance, insurance, healthcare, pharmaceuticals, technology, engineering, transportation, hospitality, entertainment, legal, government, and military sectors.​

Cognizant Microsoft Business Group (MBG) Logo

Cognizant Microsoft Business Group (MBG)

Healthgrades Logo

Healthgrades

Boxit Document Solutions Logo

Boxit Document Solutions

Jack Links Logo

Jack Links

MacDonald Humfrey (Automation) Ltd. Logo

MacDonald Humfrey (Automation) Ltd.

Teleplan Logo

Teleplan

Microsoft Logo

Microsoft

Sage Logo

Sage

Schlumberger Logo

Schlumberger

ALS Life Sciences Logo

ALS Life Sciences

Philips Logo

Philips

Brandes Investment Partners L.P. Logo

Brandes Investment Partners L.P.

CR2

Lean SA Logo

Lean SA

Alignment Healthcare Logo

Alignment Healthcare

Flowmaster (a Mentor Graphics Company) Logo

Flowmaster (a Mentor Graphics Company)

Boeing Logo

Boeing

Xceptor - Process and Data Automation Logo

Xceptor - Process and Data Automation

Nottingham County Council Logo

Nottingham County Council

Washington Department of Transport Logo

Washington Department of Transport

New Hampshire Supreme Court Logo

New Hampshire Supreme Court

Washington Department of Enterprise Services Logo

Washington Department of Enterprise Services

Ghana Police Service Logo

Ghana Police Service

Department of Work and Pensions (UK) Logo

Department of Work and Pensions (UK)

Bistech Logo

Bistech

Lean SA Logo

Lean SA

Higher Education Statistics Agency Logo

Higher Education Statistics Agency

Milliman Logo

Milliman

Philips Logo

Philips

MacDonald Humfrey (Automation) Ltd. Logo

MacDonald Humfrey (Automation) Ltd.