Skip to content

Instantly share code, notes, and snippets.

@kingargyle
Created March 24, 2013 14:48
Show Gist options
  • Save kingargyle/5232227 to your computer and use it in GitHub Desktop.
Save kingargyle/5232227 to your computer and use it in GitHub Desktop.
Profile for deploying a p2 repo, to a specified directory and providing a symbolic link for the most current version deployed. Run this as part of a release profile with your maven tycho build.
<profiles>
<profile>
<id>release-profile</id>
<properties>
<p2repo-dir>${basedir}/target/deployed-repository</p2repo-dir>
<buildNumber>${project.version}.${maven.build.timestamp}</buildNumber>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.github.goldin</groupId>
<artifactId>copy-maven-plugin</artifactId>
<version>0.2.5</version>
<executions>
<execution>
<id>deploy-p2-repository</id>
<phase>deploy</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<resources>
<resource>
<verbose>true</verbose>
<targetPath>${p2repo-dir}/${buildNumber}</targetPath>
<directory>${basedir}/target/repository</directory>
<preservePath>true</preservePath>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution><!-- Run our version calculation script -->
<id>sybmolic-link-creation</id>
<phase>deploy</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>./linkrepo.sh</executable>
<arguments>
<argument>${p2repo-dir}</argument>
<argument>${buildNumber}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
DIRECTORY=$1
P2REPO_NAME=$2
echo "Changing directory to $DIRECTORY"
cd $DIRECTORY
if [ -L "current" ]; then
echo "Removing current linked directory so it can be relinked"
rm current
fi
ln -s ./$P2REPO_NAME current
echo "Linked current to $P2REPO_NAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment