Maven release: prepare: you cannot prepare the release because you have local modifications

I had a problem with the release of the continuum: prepare a phase that does not work in the scm-check-changes step with an error:

[ERROR] org.apache.maven.shared.release.ReleaseFailureException: Cannot prepare for release because you have local modifications: [Pom.xml: modified]

What I've done:

  • I made all my changes (* .java and pom.xml) in SVN
  • I built the project in Continuum
  • I started preparing the release.

I know that scm-check modifications call the ScmCheckModificationsPhase class, which checks for the absence of local changes compared to what is in SCM.

I understand that if I work only with Maven, if there are local changes or any differences between the local code and SVN, for example, the release: the preparation will not work, because it checks the changes first; but working with Continuum, I don’t know why it should be differencse between the local code and the SVN repository? Therefore, I do not know why the release: prepare the target in Continuum is facing this problem.

An example of my pom:

<build> <plugins> ... <plugin> <artifactId>maven-release-plugin</artifactId> <configuration> <useReleaseProfile>false</useReleaseProfile> </configuration> </plugin> ... </plugins> </build> <scm> <connection>scm:cvs:ext:url:/var/cvs:application_name</connection> <developerConnection>scm:cvs:ext:url:/var/cvs:application_name</developerConnection> </scm> ..... </project> 

In the parent pom.xml:

 ... <pluginManagement> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <version>2.2.2</version> <configuration> <useReleaseProfile>false</useReleaseProfile> <goals>deploy</goals> <arguments>-Prelease</arguments> </configuration> </plugin> ..... 

For information, the assembly and release of the project always works fine, so far.

There is a workaround solution that solved my problem, but I'm still trying to understand the origin of this problem.

Workaround:

 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <version>2.2.2</version> <configuration> ... <checkModificationExcludes> <checkModificationExclude>pom.xml</checkModificationExclude> </checkModificationExcludes> </configuration> </plugin> 
+6
source share
3 answers

I can confirm that adding a plugin or configuring it to exclude pom.xml validation did work:

  <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <configuration> <checkModificationExcludes> <checkModificationExclude>pom.xml</checkModificationExclude> </checkModificationExcludes> </configuration> </plugin> 
+9
source

Removing my target project folder from the control source fixed this problem for me.

+7
source

For anyone who doesn't want to change pom.xml , the command line parameter does the trick:

mvn [...] -DcheckModificationExcludeList=pom.xml,.maven/spy.log

I had a problem with our hudson / jenkins CI environment which complained about changes to .maven/spy.log

0
source

Source: https://habr.com/ru/post/943565/


All Articles