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

Ahmed MANSOUR picture Ahmed MANSOUR · Apr 24, 2013 · Viewed 40.3k times · Source

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>

Answer

4F2E4A2E picture 4F2E4A2E · Dec 2, 2013

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>