git-commit-id/git-commit-id-maven-plugin

Endless build loop in Eclipse

apogrebnyak opened this issue · 7 comments

It happens always in my real project, but I was able to reproduce it with this sample setup.

Add a Maven project with this sample pom:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>test.git-id-plugin</groupId>
  <artifactId>git-id-plugin-eclipse</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <plugins>
      <plugin>
        <groupId>pl.project13.maven</groupId>
        <artifactId>git-commit-id-plugin</artifactId>
        <version>2.1.12</version>
        <executions>
          <execution>
            <goals>
              <goal>revision</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <verbose>true</verbose>
          <dotGitDirectory>${project.basedir}/../.git</dotGitDirectory>
          <dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
          <generateGitPropertiesFile>true</generateGitPropertiesFile>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

The project builds and stops.

Now, go to 'Navigator' view in Eclipse, and refresh target/classed directory.

The build goes into an endless loop.

If you open generated git.properties file, you will see that the build timestamp is constantly updating.

The loop can be stopped by using 'Maven/Update Project' action.

In order to reproduce the loop again, remove generated git.properties. When build finishes, the file is not visible. Now refresh the project in Eclipse navigator view, and the loop is back again.

Not sure if this is really an issue with the git-commit-id-plugin itself.
It really sounds like more as an issue how eclipse and maven works together...

At least quick googleing told me this similar issue with a total different setup. This directly links to the solution: http://stackoverflow.com/a/17235587
Maybe you can try that....I'm using eclipse STS and haven't experienced any problems like that yet...

I think the issue may be that it should compare the contents of the existing properties file to the state of the project before writing it. Do you want me to take a crack on this and submit a pull request?

-Alex

That'd be really awesome if you could give it a shot. Are you also able to
reproduce this to see if we actually fix the problem?

Konrad
(sent from mobile)
On 6 Jan 2015 17:05, "apogrebnyak" notifications@github.com wrote:

I think the issue may be that it should compare the contents of the
existing properties file to the state of the project before writing it. Do
you want me to take a crack on this and submit a pull request?

-Alex


Reply to this email directly or view it on GitHub
#151 (comment)
.

@ktoso. Will do now. Did you try the steps in the example to reproduce on your system? On mine, I most definitely see the problem.

Added pull request -> #152

Thanks a lot, i'll have a deeper look at it tomorrow.

Konrad 'ktoso’ Malawski
hAkker @ typesafe
akka.io / java.pl / geecon.org / krakowscala.pl / gdgkrakow.pl

2015-01-07 0:25 GMT+01:00 apogrebnyak notifications@github.com:

Added pull request -> #152
#152


Reply to this email directly or view it on GitHub
#151 (comment)
.

Resolved by #152

Thanks a lot for the contribution!

Resolved in 2.1.13