blog

Maven release prepare fails with detected changes in Jenkins

Published on
4 minute read

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.

[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'
[DEBUG] line -
[DEBUG] line --------------------------------------------------------------------------------
[DEBUG] line -Detected Changes:
[DEBUG] line --------------------------------------------------------------------------------
[DEBUG] line -$/main/VisualStudioALM/JavaTestProject/release.properties
[DEBUG] line -  User:       Martin Hinshelwood (MrHinsh)
[DEBUG] line -  Date:       22-May-2014 14:33:52
[DEBUG] line -  Lock:       none
[DEBUG] line -  Change:     add
[DEBUG] line -  Workspace:  Hudson-TFS-TestProject-MASTER
[DEBUG] line -  Local item: [zsts490716.eu.company.com] /appl/data/ci-test/jenkins/jobs/TFS-TestProject/workspace/release.properties
[DEBUG] line -
[DEBUG] line -0 change(s), 1 detected change(s)
[INFO] err -
[DEBUG] Iterating
[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.

######################################
# Ignore all release files from Maven release process
release.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:

######################################
# Ignore all release files from Maven release process
release.properties
*.releaseBackup
target/

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.

problems-and-puzzles upgrade-and-maintenance blog jenkins maven tfignore

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.​

Lean SA Logo
Epic Games Logo
Teleplan Logo
Slaughter and May Logo

NIT A/S

Big Data for Humans Logo
Brandes Investment Partners L.P. Logo
MacDonald Humfrey (Automation) Ltd. Logo
Qualco Logo
Jack Links Logo
Emerson Process Management Logo
Slicedbread Logo
Ericson Logo
Graham & Brown Logo
DFDS Logo
Healthgrades Logo
Microsoft Logo
Hubtel Ghana Logo
Royal Air Force Logo
Nottingham County Council Logo
New Hampshire Supreme Court Logo
Department of Work and Pensions (UK) Logo
Washington Department of Enterprise Services Logo
Washington Department of Transport Logo
Graham & Brown Logo
Brandes Investment Partners L.P. Logo
Bistech Logo
Qualco Logo
Milliman Logo
SuperControl Logo