Reputation: 8857
We're using the JDeb maven plugin to build debian packages of our one-jar'd projects.
We have two APT repositories, one for pre-release builds, and one for releases.
We're using the Wagon plugin to upload the artifacts, but we cannot figure out how to only send releases to the release repository, and snapshots to the pre-release repo.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<executions>
<execution>
<id>upload-to-nexus</id>
<phase>deploy</phase>
<goals>
<goal>upload-single</goal>
</goals>
<configuration>
<serverId>xxx-all</serverId>
<fromFile>${project.build.directory}/${jdeb.name}</fromFile>
<url>https://xxx.xxx.xxx/repository/xxx-apt-pre</url>
</configuration>
</execution>
</executions>
</plugin>
We need to change xxx-apt-pre
above to xxx-apt-dist
when the release plugin runs. For the life of me, I cannot figure out a way to do this.
I initially tried using the build-helper plugin to regex the ${project.build.finalName}
for the phrase SNAPSHOT
, but it won't overwrite the existing property.
Any ideas are welcome.
Upvotes: 0
Views: 139
Reputation: 8857
Well the solution wasn't pretty, but gets 'er done as we say in the midwest:
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<id>add-dynamic-properties</id>
<phase>package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
<![CDATA[
if (project.version.contains('SNAPSHOT')) {
project.properties['aptRepoName'] = 'xxx-apt-pre'
} else {
project.properties['aptRepoName'] = 'xxx-apt-dist'
}
]]>
</source>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<executions>
<execution>
<id>upload-to-nexus</id>
<phase>deploy</phase>
<goals>
<goal>upload-single</goal>
</goals>
<configuration>
<serverId>xxx-all</serverId>
<fromFile>${project.build.directory}/${jdeb.name}</fromFile>
<url>https://xxx.xxx.xxx/repository/${aptRepoName}</url>
</configuration>
</execution>
</executions>
</plugin>
I hope this helps someone or someday someone posts a better way.
Upvotes: 1