12
votes

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>
6
Have you checked on command line outside of continuum?khmarbaise
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
@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
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
" 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

6 Answers

22
votes

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>
9
votes

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

4
votes

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

3
votes
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
    <checkModificationExcludes>
        <checkModificationExclude>pom.xml</checkModificationExclude>
        <checkModificationExclude>**</checkModificationExclude>
    </checkModificationExcludes>
</configuration>

3
votes

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

0
votes

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