17

I'm facing a problem with continuum's release:prepare phase which fails in scm-check-modifications step with error :

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

What i did :

  1. I commited all my changes (*.java and pom.xml) into SVN
  2. I made a build of the project in Continuum
  3. I launched the preparation of the release.

I know that the scm-check-modifications calls ScmCheckModificationsPhase class that verifies that there are no local changes compared to what is on the SCM.

I understand if i'm working with only Maven, if there are some locally changes, or any differences between the local code and the SVN for example, release:prepare won't work, because it checks for modifications first; but working with Continuum,i don't know why it should be a differencse between the local code and the SVN repository ? So i don't know why the release:prepare goal in Continuum is facing that problem.

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 build and the release of the project is always working fine, until now.

There is a Bypass solution that solved my issue but i still seeking to understand the origin of this problem.

The bypass solution:

<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>
Ahmed MANSOUR
  • 2,369
  • 2
  • 27
  • 35
  • Have you checked on command line outside of continuum? – khmarbaise Apr 24 '13 at 18:18
  • comparing the modifications done in the pom.xml may give you an idea of what happened. Could you add this information to your question? – cahen Apr 24 '13 at 18:23
  • @khmarbaise: Actually no, i need to install Tortoise for this, because Maven is going to complain for the "svn" command not being recognized. Do you have any idea why Continuum will complain of a problem differences between SCM and the local code it? – Ahmed MANSOUR Apr 24 '13 at 18:24
  • Yes, it's a project of my company, they are using CVS, i just mentioned SVN for the example. @khmarbaise: could you change your last post please ? it contains the company domain, i changed it in my post. Thank you. – Ahmed MANSOUR Apr 25 '13 at 10:09
  • " why Continuum will complain of a problem differences between SCM and the local code it" - because maven-release-plugin calls to maven-scm-plugin that does the modification check. and for each provider there is different implementation. so you can check the continuum impl vs another one that works... maybe during the build Continuum changes something in the pom.xml (even a space)? – OhadR Apr 22 '15 at 19:48
  • AhmedMANSOUR please set the correct answer as valid, thx – 4F2E4A2E Sep 12 '16 at 09:48

6 Answers6

26

I can confirm, that adding the plugin or configuring it to exclude the pom.xml check did work:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-release-plugin</artifactId>
  <configuration>
    <checkModificationExcludes>
        <checkModificationExclude>pom.xml</checkModificationExclude>
    </checkModificationExcludes>
  </configuration>
</plugin>
Javier C.
  • 7,859
  • 5
  • 41
  • 53
4F2E4A2E
  • 1,964
  • 26
  • 28
12

Removing my project's target folder from source control fixed this issue for me.

Adil Hussain
  • 30,049
  • 21
  • 112
  • 147
  • 4
    As a side note, the maven's `target` folder should never be saved in the SCM since it is where maven generate intermediate and final build artifacts. – Gabriel Belingueres Apr 15 '21 at 18:51
  • This answer addresses the root cause of the error message. Note that it's not always the `target` folder. In my case, files are copied to a `provided` folder that are needed during the build, and the the folder had been mistakenly checked in. – not2savvy May 22 '23 at 09:30
5

For everybody who don't want to change the pom.xml a commandline option does the trick:

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

I had the problem on our hudson / jenkins CI environment which complained about changes in the .maven/spy.log

Lonzak
  • 9,334
  • 5
  • 57
  • 88
5
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
    <checkModificationExcludes>
        <checkModificationExclude>pom.xml</checkModificationExclude>
        <checkModificationExclude>**</checkModificationExclude>
    </checkModificationExcludes>
</configuration>

Rahul Dahiya
  • 51
  • 1
  • 1
3

For me solution is staging and commiting pom.xml or any other changed file to push git

Ali Karaca
  • 3,365
  • 1
  • 35
  • 41
0

This is just a workaround for the error . i faced same error with maven-release plugin version 2.5.3 and just sorted the error with maven-release 2.3.2