Skip to content

Instantly share code, notes, and snippets.

@mrdon
Created January 14, 2013 04:03
Show Gist options
  • Save mrdon/4527683 to your computer and use it in GitHub Desktop.
Save mrdon/4527683 to your computer and use it in GitHub Desktop.
Restore git directory for heroku builds
<build>
....
<profiles>
<profile>
<id>git</id>
<activation>
<file>
<missing>${basedir}/.git</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>validate</phase>
<id>clone-repo</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>git</executable>
<arguments>
<argument>clone</argument>
<argument>-n</argument>
<argument>https://bitbucket.org/mrdon/weapon-m.git</argument>
<argument>${project.build.directory}/checkout</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy todir="${basedir}/.git">
<fileset dir="${project.build.directory}/checkout/.git"/>
</copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
...
</build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment