signing and repository upload via ant

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1733863 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2016-03-07 01:58:26 +00:00
parent f918a441cd
commit 342047e338

433
build.xml
View File

@ -32,7 +32,12 @@ under the License.
ANT_OPTS="-Xmx1024m -XX:MaxPermSize=256m" ant test ANT_OPTS="-Xmx1024m -XX:MaxPermSize=256m" ant test
--> -->
<project name="POI Build" default="help" basedir="." xmlns:mvn="antlib:org.apache.maven.artifact.ant"> <project name="POI Build" default="help" basedir="."
xmlns:mvn="antlib:org.apache.maven.artifact.ant"
xmlns:openpgp="antlib:org.apache.commons.openpgp.ant"
xmlns:staging="antlib:org.sonatype.nexus.ant.staging"
xmlns:if="ant:if"
xmlns:unless="ant:unless">
<description>The Apache POI project Ant build.</description> <description>The Apache POI project Ant build.</description>
@ -238,6 +243,16 @@ under the License.
<property name="dist.dir" location="build/dist"/> <property name="dist.dir" location="build/dist"/>
<property name="halt.on.test.failure" value="true"/> <property name="halt.on.test.failure" value="true"/>
<!-- helper jars for pgp signing and nexus staging -->
<property name="dist.bouncycastle-prov.jar" location="${compile.lib}/bcprov-ext-jdk15on-1.51.jar"/>
<property name="dist.bouncycastle-prov.url" value="${repository.m2}/maven2/org/bouncycastle/bcprov-ext-jdk15on/1.51/bcprov-ext-jdk15on-1.51.jar"/>
<property name="dist.bouncycastle-bcpg.jar" location="${compile.lib}/bcpg-jdk15on-1.51.jar"/>
<property name="dist.bouncycastle-bcpg.url" value="${repository.m2}/maven2/org/bouncycastle/bcpg-jdk15on/1.51/bcpg-jdk15on-1.51.jar"/>
<property name="dist.commons-openpgp.jar" location="${compile.lib}/commons-openpgp-1.0-SNAPSHOT.jar"/>
<property name="dist.commons-openpgp.url" value="http://repository.apache.org/snapshots/org/apache/commons/commons-openpgp/1.0-SNAPSHOT/commons-openpgp-1.0-20140717.171036-11.jar"/>
<property name="dist.nexus-staging.jar" location="${compile.lib}/nexus-staging-ant-tasks-1.6.3-uber.jar"/>
<property name="dist.nexus-staging.url" value="${repository.m2}/maven2/org/sonatype/nexus/ant/nexus-staging-ant-tasks/1.6.3/nexus-staging-ant-tasks-1.6.3-uber.jar"/>
<propertyset id="junit.properties"> <propertyset id="junit.properties">
<propertyref name="POI.testdata.path"/> <propertyref name="POI.testdata.path"/>
<propertyref name="java.awt.headless"/> <propertyref name="java.awt.headless"/>
@ -430,13 +445,24 @@ under the License.
</delete> </delete>
</target> </target>
<target name="testexist"> <macrodef name="downloadfile">
<echo message="Testing for ${destfile}" level="debug"/> <attribute name="src"/>
<available file="${destfile}" property="exist"/> <attribute name="dest"/>
</target> <sequential>
<target name="downloadfile" unless="exist" depends="testexist"> <local name="exists"/>
<get src="${sourcefile}" dest="${destfile}"/> <available file="@{dest}" property="exists"/>
</target> <fail unless:true="${exists}"
message="Java version might be uncapable to download https URLs - see http://stackoverflow.com/questions/6851461/java-why-does-ssl-handshake-give-could-not-generate-dh-keypair-exception">
<condition>
<and>
<equals arg1="${ant.java.version}" arg2="1.6"/>
<contains string="@{src}" substring="https"/>
</and>
</condition>
</fail>
<get src="@{src}" dest="@{dest}" unless:true="${exists}"/>
</sequential>
</macrodef>
<target name="check-jars"> <target name="check-jars">
<!-- remove previous versions of third-party jars to prevent them from lingering around, <!-- remove previous versions of third-party jars to prevent them from lingering around,
@ -517,71 +543,26 @@ under the License.
<target name="fetch-jars" depends="check-jars" unless="jars.present" <target name="fetch-jars" depends="check-jars" unless="jars.present"
description="Fetches needed JAR files from the Internet"> description="Fetches needed JAR files from the Internet">
<mkdir dir="${main.lib}"/> <mkdir dir="${main.lib}"/>
<antcall target="downloadfile"> <downloadfile src="${main.commons-logging.url}" dest="${main.commons-logging.jar}"/>
<param name="sourcefile" value="${main.commons-logging.url}"/> <downloadfile src="${main.commons-codec.url}" dest="${main.commons-codec.jar}"/>
<param name="destfile" value="${main.commons-logging.jar}"/> <downloadfile src="${main.log4j.url}" dest="${main.log4j.jar}"/>
</antcall> <downloadfile src="${main.junit.url}" dest="${main.junit.jar}"/>
<antcall target="downloadfile"> <downloadfile src="${main.hamcrest.url}" dest="${main.hamcrest.jar}"/>
<param name="sourcefile" value="${main.commons-codec.url}"/> <downloadfile src="${main.ant.url}" dest="${main.ant.jar}"/>
<param name="destfile" value="${main.commons-codec.jar}"/> <downloadfile src="${main.antlauncher.url}" dest="${main.antlauncher.jar}"/>
</antcall> <downloadfile src="${asm.url}" dest="${asm.jar}"/>
<antcall target="downloadfile"> <downloadfile src="${jacoco.url}" dest="${jacoco.zip}"/>
<param name="sourcefile" value="${main.log4j.url}"/>
<param name="destfile" value="${main.log4j.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${main.junit.url}"/>
<param name="destfile" value="${main.junit.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${main.hamcrest.url}"/>
<param name="destfile" value="${main.hamcrest.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${main.ant.url}"/>
<param name="destfile" value="${main.ant.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${main.antlauncher.url}"/>
<param name="destfile" value="${main.antlauncher.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${asm.url}"/>
<param name="destfile" value="${asm.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${jacoco.url}"/>
<param name="destfile" value="${jacoco.zip}"/>
</antcall>
<unzip src="${jacoco.zip}" dest="."> <unzip src="${jacoco.zip}" dest=".">
<patternset> <patternset>
<include name="lib/*.jar"/> <include name="lib/*.jar"/>
</patternset> </patternset>
</unzip> </unzip>
<antcall target="downloadfile"> <downloadfile src="${rat.url}" dest="${rat.jar}"/>
<param name="sourcefile" value="${rat.url}"/> <downloadfile src="${forbidden.url}" dest="${forbidden.jar}"/>
<param name="destfile" value="${rat.jar}"/> <downloadfile src="${dsig.bouncycastle-prov.url}" dest="${dsig.bouncycastle-prov.jar}"/>
</antcall> <downloadfile src="${dsig.bouncycastle-pkix.url}" dest="${dsig.bouncycastle-pkix.jar}"/>
<antcall target="downloadfile"> <downloadfile src="${dsig.xmlsec.url}" dest="${dsig.xmlsec.jar}"/>
<param name="sourcefile" value="${forbidden.url}"/> <downloadfile src="${dsig.sl4j-api.url}" dest="${dsig.sl4j-api.jar}"/>
<param name="destfile" value="${forbidden.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${dsig.bouncycastle-prov.url}"/>
<param name="destfile" value="${dsig.bouncycastle-prov.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${dsig.bouncycastle-pkix.url}"/>
<param name="destfile" value="${dsig.bouncycastle-pkix.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${dsig.xmlsec.url}"/>
<param name="destfile" value="${dsig.xmlsec.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${dsig.sl4j-api.url}"/>
<param name="destfile" value="${dsig.sl4j-api.jar}"/>
</antcall>
</target> </target>
<target name="check-ooxml-jars"> <target name="check-ooxml-jars">
@ -598,18 +579,9 @@ under the License.
</target> </target>
<target name="fetch-ooxml-jars" depends="check-ooxml-jars" unless="ooxml.jars.present"> <target name="fetch-ooxml-jars" depends="check-ooxml-jars" unless="ooxml.jars.present">
<mkdir dir="${ooxml.lib}"/> <mkdir dir="${ooxml.lib}"/>
<antcall target="downloadfile"> <downloadfile src="${ooxml.curvesapi.url}" dest="${ooxml.curvesapi.jar}"/>
<param name="sourcefile" value="${ooxml.curvesapi.url}"/> <downloadfile src="${ooxml.xmlbeans23.url}" dest="${ooxml.xmlbeans23.jar}"/>
<param name="destfile" value="${ooxml.curvesapi.jar}"/> <downloadfile src="${ooxml.xmlbeans26.url}" dest="${ooxml.xmlbeans26.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${ooxml.xmlbeans23.url}"/>
<param name="destfile" value="${ooxml.xmlbeans23.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${ooxml.xmlbeans26.url}"/>
<param name="destfile" value="${ooxml.xmlbeans26.jar}"/>
</antcall>
</target> </target>
<target name="check-ooxml-xsds"> <target name="check-ooxml-xsds">
@ -1441,58 +1413,23 @@ under the License.
description="Builds the POM files for a maven distribution, and copies these and the jars to the appropriate locations"> description="Builds the POM files for a maven distribution, and copies these and the jars to the appropriate locations">
<!-- Build the org.apache.poi poms --> <!-- Build the org.apache.poi poms -->
<copy file="maven/poi.pom" tofile="${dist.dir}/poi-${version.id}.pom"> <copy todir="${dist.dir}/maven">
<fileset dir="maven" includes="poi*.pom"/>
<chainedmapper>
<firstmatchmapper>
<regexpmapper from="^(.*).pom$$" to="\1/\1.pom"/>
<globmapper from="poi.pom" to="poi/poi.pom"/>
</firstmatchmapper>
<globmapper from="*.pom" to="*-${version.id}.pom"/>
</chainedmapper>
<filterchain> <filterchain>
<replacetokens> <replacetokens>
<token key="VERSION" value="${version.id}"/> <token key="VERSION" value="${version.id}"/>
</replacetokens> </replacetokens>
</filterchain> </filterchain>
</copy> </copy>
<copy file="maven/poi-scratchpad.pom" tofile="${dist.dir}/poi-scratchpad-${version.id}.pom">
<filterchain>
<replacetokens>
<token key="VERSION" value="${version.id}"/>
</replacetokens>
</filterchain>
</copy>
<copy file="maven/poi-ooxml.pom" tofile="${dist.dir}/poi-ooxml-${version.id}.pom">
<filterchain>
<replacetokens>
<token key="VERSION" value="${version.id}"/>
</replacetokens>
</filterchain>
</copy>
<copy file="maven/poi-examples.pom" tofile="${dist.dir}/poi-examples-${version.id}.pom">
<filterchain>
<replacetokens>
<token key="VERSION" value="${version.id}"/>
</replacetokens>
</filterchain>
</copy>
<copy file="maven/poi-ooxml-schemas.pom" tofile="${dist.dir}/poi-ooxml-schemas-${version.id}.pom">
<filterchain>
<replacetokens>
<token key="VERSION" value="${version.id}"/>
</replacetokens>
</filterchain>
</copy>
<copy file="maven/poi-excelant.pom" tofile="${dist.dir}/poi-excelant-${version.id}.pom">
<filterchain>
<replacetokens>
<token key="VERSION" value="${version.id}"/>
</replacetokens>
</filterchain>
</copy>
<copy file="maven/mvn-deploy.sh" todir="${dist.dir}">
<filterchain>
<replacetokens>
<token key="VERSION" value="${version.id}"/>
<token key="DSTAMP" value="${DSTAMP}"/>
</replacetokens>
</filterchain>
</copy>
<echo>Maven POMs are located in ${dist.dir}</echo> <echo>Maven POMs are located in ${dist.dir}</echo>
<echo>Use mvn-deploy.sh to deploy the artifacts in the remote repository</echo> <echo>Use ant dist-nexus to deploy the artifacts in the remote repository</echo>
</target> </target>
<target name="-manifest"> <target name="-manifest">
@ -1508,65 +1445,48 @@ under the License.
</manifest> </manifest>
</target> </target>
<macrodef name="maven-jar">
<attribute name="dir"/>
<sequential>
<local name="destfile"/>
<pathconvert property="destfile" targetos="unix">
<path><pathelement path="@{dir}"/></path>
<mapper>
<chainedmapper>
<filtermapper>
<replaceregex pattern="ooxml-lite" replace="ooxml-schemas" flags="g"/>
<replaceregex pattern="(.java|.src)$$" replace="-sources"/>
<replaceregex pattern=".*(?:build|src).?(.*)?" replace="\1"/>
<replaceregex pattern="(.*)(-classes|-sources)" replace="poi-\1/poi-\1-${version.id}\2"/>
<replaceregex pattern="^(classes|sources)$$" replace="poi/poi-${version.id}-\1"/>
<replaceregex pattern="-classes" replace=""/>
</filtermapper>
</chainedmapper>
</mapper>
</pathconvert>
<jar destfile="build/dist/maven/${destfile}.jar"
manifest="build/poi-manifest.mf">
<fileset dir="@{dir}"/>
<metainf dir="legal/"/>
</jar>
</sequential>
</macrodef>
<target name="jar" depends="compile-all, compile-version, -manifest" description="Creates jar files for distribution"> <target name="jar" depends="compile-all, compile-version, -manifest" description="Creates jar files for distribution">
<jar destfile="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" <maven-jar dir="${main.output.dir}"/>
manifest="build/poi-manifest.mf"> <maven-jar dir="${scratchpad.output.dir}"/>
<fileset dir="${main.output.dir}"/> <maven-jar dir="${ooxml.output.dir}"/>
<metainf dir="legal/"/> <maven-jar dir="${examples.output.dir}"/>
</jar> <maven-jar dir="${excelant.output.dir}"/>
<jar destfile="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" <maven-jar dir="${ooxml.lite.output.dir}"/>
manifest="build/poi-manifest.mf">
<fileset dir="${scratchpad.output.dir}"/>
<metainf dir="legal/"/>
</jar>
<jar destfile="${dist.dir}/${jar.name}-ooxml-${version.id}-${DSTAMP}.jar"
manifest="build/poi-manifest.mf">
<fileset dir="${ooxml.output.dir}"/>
<metainf dir="legal/"/>
</jar>
<jar destfile="${dist.dir}/${jar.name}-examples-${version.id}-${DSTAMP}.jar"
manifest="build/poi-manifest.mf">
<fileset dir="${examples.output.dir}"/>
<metainf dir="legal/"/>
</jar>
<jar destfile="${dist.dir}/${jar.name}-ooxml-schemas-${version.id}-${DSTAMP}.jar"
manifest="build/poi-manifest.mf">
<fileset dir="${ooxml.lite.output.dir}"/>
<metainf dir="legal/"/>
</jar>
<jar destfile="${dist.dir}/${jar.name}-excelant-${version.id}-${DSTAMP}.jar"
manifest="build/poi-manifest.mf">
<fileset dir="${excelant.output.dir}"/>
<metainf dir="legal/"/>
</jar>
</target> </target>
<target name="jar-src" depends="compile-all, compile-version, -manifest" description="Sources for Maven"> <target name="jar-src" depends="compile-all, compile-version, -manifest" description="Sources for Maven">
<jar destfile="${dist.dir}/${jar.name}-${version.id}-sources-${DSTAMP}.jar" <maven-jar dir="${main.src}"/>
manifest="build/poi-manifest.mf"> <maven-jar dir="${scratchpad.src}"/>
<fileset dir="${main.src}"/> <maven-jar dir="${ooxml.src}"/>
<metainf dir="legal/"/> <maven-jar dir="${examples.src}"/>
</jar> <maven-jar dir="${excelant.src}"/>
<jar destfile="${dist.dir}/${jar.name}-scratchpad-${version.id}-sources-${DSTAMP}.jar"
manifest="build/poi-manifest.mf">
<fileset dir="${scratchpad.src}"/>
<metainf dir="legal/"/>
</jar>
<jar destfile="${dist.dir}/${jar.name}-ooxml-${version.id}-sources-${DSTAMP}.jar"
manifest="build/poi-manifest.mf">
<fileset dir="${ooxml.src}"/>
<metainf dir="legal/"/>
</jar>
<jar destfile="${dist.dir}/${jar.name}-examples-${version.id}-sources-${DSTAMP}.jar"
manifest="build/poi-manifest.mf">
<fileset dir="${examples.src}"/>
<metainf dir="legal/"/>
</jar>
<jar destfile="${dist.dir}/${jar.name}-excelant-${version.id}-sources-${DSTAMP}.jar"
manifest="build/poi-manifest.mf">
<fileset dir="${excelant.src}"/>
<metainf dir="legal/"/>
</jar>
</target> </target>
@ -1582,46 +1502,42 @@ under the License.
<antcall target="javadocs"/> <antcall target="javadocs"/>
</target> </target>
<target name="jar-javadocs" description="JavaDocs for Maven" depends="compile,-manifest,-do-jar-create-javadocs-package-list"> <target name="jar-javadocs" description="JavaDocs for Maven" depends="compile,-manifest,-do-jar-create-javadocs-package-list">
<property name="build.maven.javadocs" location="build/tmp/maven-javadocs"/> <property name="build.maven.javadocs" location="build/tmp/maven-javadocs"/>
<!-- Build and package the main javadocs --> <!-- Build and package the main javadocs -->
<antcall target="-do-jar-javadocs"> <maven-javadocs src="${main.src}" dest="${jar.name}"/>
<param name="srcfolder" value="${main.src}" />
<param name="jarname" value="${jar.name}" />
</antcall>
<!-- Build and package the scratchpad javadocs --> <!-- Build and package the scratchpad javadocs -->
<antcall target="-do-jar-javadocs"> <maven-javadocs src="${scratchpad.src}" dest="${jar.name}-scratchpad"/>
<param name="srcfolder" value="${scratchpad.src}" />
<param name="jarname" value="${jar.name}-scratchpad" />
</antcall>
<!-- Build and package the ooxml javadocs --> <!-- Build and package the ooxml javadocs -->
<antcall target="-do-jar-javadocs"> <maven-javadocs src="${ooxml.src}" dest="${jar.name}-ooxml"/>
<param name="srcfolder" value="${ooxml.src}" />
<param name="jarname" value="${jar.name}-ooxml" />
</antcall>
</target> </target>
<target name="-do-jar-javadocs"> <macrodef name="maven-javadocs">
<echo message="Building ${jarname} javadocs from ${srcfolder}" /> <attribute name="src"/>
<delete dir="${build.maven.javadocs}"/> <attribute name="dest"/>
<mkdir dir="${build.maven.javadocs}"/> <sequential>
<javadoc verbose="false" author="false" destdir="${build.maven.javadocs}" <echo message="Building @{dest} javadocs from @{src}" />
windowtitle="POI API Documentation" use="false" version="false" <local name="build.maven.javadocs"/>
maxmemory="384M" additionalparam="-notimestamp -quiet" locale="en_US" <property name="build.maven.javadocs" location="build/tmp/maven-javadocs"/>
classpathref="javadoc.classpath"> <delete dir="${build.maven.javadocs}"/>
<packageset dir="${srcfolder}" defaultexcludes="yes"> <mkdir dir="${build.maven.javadocs}"/>
<include name="org/apache/poi/**"/> <javadoc verbose="false" author="false" destdir="${build.maven.javadocs}"
</packageset> windowtitle="POI API Documentation" use="false" version="false"
<link offline="true" href="https://poi.apache.org/apidocs" packagelistLoc="build/tmp/site/build/site/apidocs"/> maxmemory="384M" additionalparam="-notimestamp -quiet" locale="en_US"
</javadoc> classpathref="javadoc.classpath">
<jar destfile="${dist.dir}/${jarname}-${version.id}-javadoc-${DSTAMP}.jar" <packageset dir="@{src}" defaultexcludes="yes">
manifest="build/poi-manifest.mf"> <include name="org/apache/poi/**"/>
<fileset dir="${build.maven.javadocs}"/> </packageset>
<metainf dir="legal/"/> <link offline="true" href="https://poi.apache.org/apidocs" packagelistLoc="build/tmp/site/build/site/apidocs"/>
</jar> </javadoc>
</target> <jar destfile="${dist.dir}/maven/@{dest}/@{dest}-${version.id}-javadoc.jar"
manifest="build/poi-manifest.mf">
<fileset dir="${build.maven.javadocs}"/>
<metainf dir="legal/"/>
</jar>
</sequential>
</macrodef>
<target name="release-notes" depends="init"> <target name="release-notes" depends="init">
<copy file="src/documentation/RELEASE-NOTES.txt" todir="build/dist/"> <copy file="src/documentation/RELEASE-NOTES.txt" todir="build/dist/">
@ -1871,10 +1787,9 @@ under the License.
<target name="findbugs"> <target name="findbugs">
<!-- NOTE: we did not update to 3.x yet because it requires Java 7, but we are still supporting Java 6 currently! --> <!-- NOTE: we did not update to 3.x yet because it requires Java 7, but we are still supporting Java 6 currently! -->
<antcall target="downloadfile"> <downloadfile
<param name="sourcefile" value="http://prdownloads.sourceforge.net/findbugs/findbugs-noUpdateChecks-2.0.3.zip?download"/> src="http://prdownloads.sourceforge.net/findbugs/findbugs-noUpdateChecks-2.0.3.zip?download"
<param name="destfile" value="${main.lib}/findbugs-noUpdateChecks-2.0.3.zip"/> dest="${main.lib}/findbugs-noUpdateChecks-2.0.3.zip"/>
</antcall>
<unzip src="${main.lib}/findbugs-noUpdateChecks-2.0.3.zip" <unzip src="${main.lib}/findbugs-noUpdateChecks-2.0.3.zip"
dest="build/findbugs/lib"> dest="build/findbugs/lib">
@ -1967,4 +1882,90 @@ under the License.
--> -->
</target> </target>
<target name="dist-checksum" depends="load-maven-server-settings">
<fileset id="dist-archives" dir="${dist.dir}" includes="**/*.jar,**/*.pom,**/*.zip,**/*.tar.gz"/>
<checksum algorithm="sha1" format="MD5SUM">
<fileset refid="dist-archives"/>
</checksum>
<checksum algorithm="md5" format="MD5SUM">
<fileset refid="dist-archives"/>
</checksum>
<fixcrlf srcDir="${dist.dir}" includes="**/*.md5,**/*.sha1" eol="unix"/>
<downloadfile src="${dist.bouncycastle-prov.url}" dest="${dist.bouncycastle-prov.jar}"/>
<downloadfile src="${dist.bouncycastle-bcpg.url}" dest="${dist.bouncycastle-bcpg.jar}"/>
<downloadfile src="${dist.commons-openpgp.url}" dest="${dist.commons-openpgp.jar}"/>
<taskdef resource="org/apache/commons/openpgp/ant/antlib.xml" uri="antlib:org.apache.commons.openpgp.ant">
<classpath>
<pathelement path="${dist.commons-openpgp.jar}"/>
<pathelement path="${dist.bouncycastle-prov.jar}"/>
<pathelement path="${dist.bouncycastle-bcpg.jar}"/>
</classpath>
</taskdef>
<openpgp:signer secring="${settings.poi-signing.privateKey}"
pubring="${settings.poi-signing.publicKey}"
password="${settings.poi-signing.passphrase}" keyid="${settings.poi-signing.username}"
asciiarmor="true">
<fileset refid="dist-archives"/>
</openpgp:signer>
</target>
<macrodef name="nexus-upload">
<attribute name="artifactId"/>
<sequential>
<downloadfile src="${dist.nexus-staging.url}" dest="${dist.nexus-staging.jar}"/>
<taskdef uri="antlib:org.sonatype.nexus.ant.staging" resource="org/sonatype/nexus/ant/staging/antlib.xml">
<classpath><pathelement path="${dist.nexus-staging.jar}"/></classpath>
</taskdef>
<staging:stageRemotely keepStagingRepositoryOnFailure="true" description="@{artifactId} ${version.id}">
<staging:nexusStagingInfo stagingDirectory="build/dist/maven/@{artifactId}">
<staging:projectInfo groupId="org.apache.poi" artifactId="@{artifactId}" version="${version.id}" />
<staging:connectionInfo baseUrl="https://repository.apache.org">
<staging:authentication username="${settings.apache-nexus.username}" password="${settings.apache-nexus.password}" />
</staging:connectionInfo>
</staging:nexusStagingInfo>
</staging:stageRemotely>
</sequential>
</macrodef>
<target name="dist-nexus" depends="load-maven-server-settings,dist-checksum">
<!-- if this throws a "... dh keypair ..." exception, use Java 7+ for executing the task -->
<nexus-upload artifactId="poi"/>
<nexus-upload artifactId="poi-examples"/>
<nexus-upload artifactId="poi-excelant"/>
<nexus-upload artifactId="poi-ooxml"/>
<nexus-upload artifactId="poi-ooxml-schemas"/>
<nexus-upload artifactId="poi-scratchpad"/>
</target>
<!--
Configure gpg settings in local maven settings.xml
see release-guide.txt for more details
-->
<target name="load-maven-server-settings">
<xslt in="${user.home}/.m2/settings.xml" out="build/tmp/signing.properties">
<style>
<string><![CDATA[
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mvn="http://maven.apache.org/SETTINGS/1.0.0">
<xsl:output method="text" version="1.0" encoding="ISO-8859-1"/>
<xsl:template match="@*|text()"/>
<xsl:template match="//mvn:server[contains('poi-signing|apache-nexus',mvn:id/text())]/*[name(.)!='id']">
<xsl:value-of select="concat('settings.',../mvn:id,'.',name(.),'=',translate(text(),'\','/'),'&#010;')"/>
</xsl:template>
</xsl:stylesheet>
]]></string>
</style>
</xslt>
<loadproperties srcFile="build/tmp/signing.properties"/>
<pathconvert property="settings.poi-signing.publicKey">
<path><pathelement path="${settings.poi-signing.privateKey}"/></path>
<mapper><filtermapper><replacestring from="secring" to="pubring"/></filtermapper></mapper>
</pathconvert>
</target>
</project> </project>