I use maven release plugin. In my pom exists and Ant task that automatically fix some properties files with additional information. This fixes should not be in SCM.
But maven don't finish with success for error:
Cannot prepare the release because you have local modifications
Does it possible to set some parameters to don't check local modifications?
Thanks.
I'm not very familiar with maven-release-plugin, but I can see that there is a checkModificationExcludes property that you can use for your purpose. The config should be somewhat like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.2</version>
<configuration>
...
<checkModificationExcludes>
<checkModificationExclude>file_1</checkModificationExclude>
<checkModificationExclude>dir_1/file_2</checkModificationExclude>
</checkModificationExcludes>
</configuration>
</plugin>
We were trying to run the release from jenkins but it always failed with the same message...
Cannot prepare the release because you have local modifications
... which was weird, because we use jenkins to check out and build the latest sources before releasing.
We finally figured out that the problem was that we were building on a Windows node and some file paths were too long which caused the maven-release-plugin to complain about local modifications. Switching to a linux node solved this problem.
I would suggest fixing your build process, so that it does not 'fix up' files that are under SCM. There are several ways of doing this, the simplest is to copy properties files in question to some directory under ${project.build.outputDirectory}
, and run your Ant script on these files, rather than originals
@AndrewLogvinov's answer is half way there. The other half is mentioned in this:
I discovered that the comparison
in org.apache.maven.shared.release.phase.ScmCheckModificationsPhase.execute()
strips the path and compares file names only. So, I changed my pom to ignore
application.properties instead of ${thewholepath}/applications properties.
Lo and behold, success.
For some weird reason, you can't include paths in this tag. You can only specify file names.
Removing my project's target
folder from source control fixed this issue for me.