Skip to content

Commit

Permalink
Update mvn-pub.xml
Browse files Browse the repository at this point in the history
Upgrading maven release configuration for non interactive deploy
  • Loading branch information
cesarhernandezgt authored Sep 29, 2023
1 parent 133982b commit 8168785
Showing 1 changed file with 89 additions and 106 deletions.
195 changes: 89 additions & 106 deletions res/maven/mvn-pub.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
limitations under the License.
-->
<project name="Tomcat 7.0 Maven Deployment" default="" basedir="."
xmlns:artifact="urn:maven-artifact-ant">
<!--
Built for using Maven Ant Tasks (version 2.1.0 is known to work)
-->
xmlns:resolver="antlib:org.apache.maven.resolver.ant"
xmlns:if="ant:if"
xmlns:unless="ant:unless">

<property file="${basedir}/mvn.properties"/>
<property file="${basedir}/mvn.properties.default"/>
<property name="local.repo" value="${user.home}/.m2/repository"/>
<property name="aether.checksums.algorithms" value="MD5,SHA-1,SHA-256,SHA-512"/>

<target name="init-maven">
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
Expand All @@ -49,44 +49,32 @@
</copy>

<!--sign the jar, the source and the pom -->
<exec executable="${gpg.exec}" failonerror="true"
inputstring="${gpg.passphrase}">
<arg value="--passphrase-fd"/>
<arg value="0"/>
<arg value="-a"/>
<arg value="-b"/>
<arg value="${file}"/>
</exec>
<exec executable="${gpg.exec}" failonerror="true"
inputstring="${gpg.passphrase}">
<arg value="--passphrase-fd"/>
<arg value="0"/>
<arg value="-a"/>
<arg value="-b"/>
<arg value="${src}"/>
</exec>
<exec executable="${gpg.exec}" failonerror="true"
inputstring="${gpg.passphrase}">
<arg value="--passphrase-fd"/>
<arg value="0"/>
<arg value="-a"/>
<arg value="-b"/>
<arg value="-o"/>
<arg value="${pom}.asc"/>
<arg value="${pom}.tmp"/>
</exec>
<antcall target="-sign" >
<param name="file.in" value="${file}" />
<param name="file.out" value="${file}.asc" />
</antcall>
<antcall target="-sign" >
<param name="file.in" value="${src}" />
<param name="file.out" value="${src}.asc" />
</antcall>
<antcall target="-sign" >
<param name="file.in" value="${pom}.tmp" />
<param name="file.out" value="${pom}.asc" />
</antcall>

<artifact:deploy file="${file}">
<pom file="${pom}.tmp"/>
<remoteRepository url="${maven.repo.url}" layout="default">
<authentication username="${asf.ldap.username}"
password="${asf.ldap.password}"/>
</remoteRepository>
<attach file="${file}.asc" type="jar.asc"/>
<attach file="${src}" classifier="sources" type="jar"/>
<attach file="${src}.asc" classifier="sources" type="jar.asc"/>
<attach file="${pom}.asc" type="pom.asc"/>
</artifact:deploy>
<resolver:deploy>
<artifact file="${file}" />
<pom file="${pom}.tmp"/>
<remoterepo id="${maven.repo.repositoryId}" url="${maven.repo.url}">
<authentication username="${asf.ldap.username}"
password="${asf.ldap.password}"
unless:set="maven.auth.useSettings" />
</remoterepo>
<artifact file="${file}.asc" type="jar.asc" if:set="gpg.passphrase"/>
<artifact file="${src}" classifier="sources" type="jar"/>
<artifact file="${src}.asc" classifier="sources" type="jar.asc" if:set="gpg.passphrase"/>
<artifact file="${pom}.asc" type="pom.asc" if:set="gpg.passphrase"/>
</resolver:deploy>

<delete file="${pom}.tmp"/>
<delete file="${pom}.asc"/>
Expand Down Expand Up @@ -128,34 +116,26 @@
</copy>

<!--sign the file and pom -->
<exec executable="${gpg.exec}" failonerror="true"
inputstring="${gpg.passphrase}">
<arg value="--passphrase-fd"/>
<arg value="0"/>
<arg value="-a"/>
<arg value="-b"/>
<arg value="${file}"/>
</exec>
<exec executable="${gpg.exec}" failonerror="true"
inputstring="${gpg.passphrase}">
<arg value="--passphrase-fd"/>
<arg value="0"/>
<arg value="-a"/>
<arg value="-b"/>
<arg value="-o"/>
<arg value="${pom}.asc"/>
<arg value="${pom}.tmp"/>
</exec>
<antcall target="-sign" >
<param name="file.in" value="${file}" />
<param name="file.out" value="${file}.asc" />
</antcall>
<antcall target="-sign" >
<param name="file.in" value="${pom}.tmp" />
<param name="file.out" value="${pom}.asc" />
</antcall>

<artifact:deploy file="${file}">
<resolver:deploy>
<artifact file="${file}" />
<pom file="${pom}.tmp"/>
<remoteRepository url="${maven.repo.url}" layout="default" >
<remoterepo id="${maven.repo.repositoryId}" url="${maven.repo.url}">
<authentication username="${asf.ldap.username}"
password="${asf.ldap.password}"/>
</remoteRepository>
<attach file="${file}.asc" type="jar.asc"/>
<attach file="${pom}.asc" type="pom.asc"/>
</artifact:deploy>
password="${asf.ldap.password}"
unless:set="maven.auth.useSettings"/>
</remoterepo>
<artifact file="${file}.asc" type="jar.asc" if:set="gpg.passphrase"/>
<artifact file="${pom}.asc" type="pom.asc" if:set="gpg.passphrase"/>
</resolver:deploy>

<delete file="${pom}.tmp"/>
<delete file="${pom}.asc"/>
Expand Down Expand Up @@ -193,45 +173,32 @@
</copy>

<!--sign the zip, the tar.gz and the pom -->
<exec executable="${gpg.exec}" failonerror="true"
inputstring="${gpg.passphrase}">
<arg value="--passphrase-fd"/>
<arg value="0"/>
<arg value="-a"/>
<arg value="-b"/>
<arg value="${file}.zip"/>
</exec>
<exec executable="${gpg.exec}" failonerror="true"
inputstring="${gpg.passphrase}">
<arg value="--passphrase-fd"/>
<arg value="0"/>
<arg value="-a"/>
<arg value="-b"/>
<arg value="${file}.tar.gz"/>
</exec>
<exec executable="${gpg.exec}" failonerror="true"
inputstring="${gpg.passphrase}">
<arg value="--passphrase-fd"/>
<arg value="0"/>
<arg value="-a"/>
<arg value="-b"/>
<arg value="-o"/>
<arg value="${pom}.asc"/>
<arg value="${pom}.tmp"/>
</exec>
<antcall target="-sign" >
<param name="file.in" value="${file}.zip" />
<param name="file.out" value="${file}.zip.asc" />
</antcall>
<antcall target="-sign" >
<param name="file.in" value="${file}.tar.gz" />
<param name="file.out" value="${file}.tar.gz.asc" />
</antcall>
<antcall target="-sign" >
<param name="file.in" value="${pom}.tmp" />
<param name="file.out" value="${pom}.asc" />
</antcall>

<artifact:deploy file="${pom}">
<pom file="${pom}.tmp"/>
<remoteRepository url="${maven.repo.url}" layout="default">
<authentication username="${asf.ldap.username}"
password="${asf.ldap.password}"/>
</remoteRepository>
<attach file="${file}.zip" type="zip"/>
<attach file="${file}.zip.asc" type="zip.asc"/>
<attach file="${file}.tar.gz" type="tar.gz"/>
<attach file="${file}.tar.gz.asc" type="tar.gz.asc"/>
<attach file="${pom}.asc" type="pom.asc"/>
</artifact:deploy>
<resolver:deploy>
<pom file="${pom}.tmp"/>
<remoterepo id="${maven.repo.repositoryId}" url="${maven.repo.url}">
<authentication username="${asf.ldap.username}"
password="${asf.ldap.password}"
unless:set="maven.auth.useSettings"/>
</remoterepo>
<artifact file="${file}.zip" type="zip"/>
<artifact file="${file}.zip.asc" type="zip.asc" if:set="gpg.passphrase"/>
<artifact file="${file}.tar.gz" type="tar.gz"/>
<artifact file="${file}.tar.gz.asc" type="tar.gz.asc" if:set="gpg.passphrase"/>
<artifact file="${pom}.asc" type="pom.asc" if:set="gpg.passphrase"/>
</resolver:deploy>

<delete file="${pom}.tmp"/>
<delete file="${pom}.asc"/>
Expand Down Expand Up @@ -399,7 +366,7 @@
</antcall>
</target>

<target name="init-gpg-1">
<target name="init-gpg-1">
<available file="${gpg.exec}" property="gpg.exec.available"/>
</target>

Expand All @@ -409,11 +376,27 @@
</input>
</target>

<target name="init-ldap">
<target name="init-ldap" unless="maven.auth.useSettings">
<input message="Enter ASF LDAP (same as svn) password"
addproperty="asf.ldap.password" >
<handler type="secure"/>
</input>
</target>

<target name="-sign" if="gpg.passphrase">
<fail unless="file" />
<exec executable="${gpg.exec}" failonerror="true"
inputstring="${gpg.passphrase}">
<arg value="--batch"/>
<arg value="--pinentry-mode"/>
<arg value="loopback"/>
<arg value="--passphrase-fd"/>
<arg value="0"/>
<arg value="-a"/>
<arg value="-b"/>
<arg value="-o"/>
<arg value="${file.out}"/>
<arg value="${file.in}"/>
</exec>
</target>
</project>

0 comments on commit 8168785

Please sign in to comment.