]> source.dussan.org Git - poi.git/commitdiff
Nexus upload - mimic the manually uploaded repositories - see [INFRA-11687]
authorAndreas Beeker <kiwiwings@apache.org>
Fri, 15 Apr 2016 11:06:58 +0000 (11:06 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Fri, 15 Apr 2016 11:06:58 +0000 (11:06 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1739281 13f79535-47bb-0310-9956-ffa450edef68

build.xml

index b0369e58ff7cbfb370e23e2ff7106f456e8cae99..4259321ee26a3246e69ac33f3d106adb81773def 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -1985,18 +1985,76 @@ under the License.
         </openpgp:signer>
     </target>
 
+    <target name="dist-nexus" depends="load-maven-server-settings,dist-checksum">
+        <delete dir="build/repo"/>
+        <delete dir="build/nexus-stage"/>
+        <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>
+
     <macrodef name="nexus-upload">
         <attribute name="artifactId"/>
         <sequential>
+            <local name="repo"/>
+            <property name="repo" location="build/repo/@{artifactId}"/>
+
+            <copy todir="${repo}">
+                <mappedresources>
+                    <fileset dir="build/dist/maven" includes="@{artifactId}/**"/>
+                    <regexpmapper from="^([^/]+)/(.*)$$" to="org/apache/poi/\1/${version.id}/\2" handledirsep="true"/>
+                </mappedresources>
+            </copy>
+
+            <local name="lastUpdated"/>
+            <tstamp>
+                <format property="lastUpdated" pattern="yyyyMMddHHmmss" timezone="UTC"/>
+            </tstamp>            
+
+            <local name="metadir"/>
+            <property name="metadir" location="${repo}/org/apache/poi/@{artifactId}"/>
+
+            <echo file="${metadir}/maven-metadata.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<metadata>
+  <groupId>org.apache.poi</groupId>
+  <artifactId>@{artifactId}</artifactId>
+  <versioning>
+    <latest>${version.id}</latest>
+    <release>${version.id}</release>
+    <versions>
+      <version>${version.id}</version>
+    </versions>
+    <lastUpdated>${lastUpdated}</lastUpdated>
+  </versioning>
+</metadata>]]></echo>
+            <fixcrlf srcdir="${metadir}" includes="maven-metadata.xml" eol="unix" eof="remove" />
+            <checksum algorithm="sha1" format="MD5SUM">
+                <fileset dir="${metadir}" includes="maven-metadata.xml"/>
+            </checksum>
+            <checksum algorithm="md5" format="MD5SUM">
+                <fileset dir="${metadir}" includes="maven-metadata.xml"/>
+            </checksum>
+
+            <fixcrlf srcDir="${metadir}" includes="*.md5,*.sha1" eol="unix"/>
+
             <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:stageLocally description="@{artifactId} ${version.id}">
+                <staging:nexusStagingInfo stagingDirectory="build/nexus-stage/@{artifactId}"/>
+                <fileset dir="${repo}" />
+            </staging:stageLocally>
+
+            <!-- if this throws a "... dh keypair ..." exception, use Java 7+ for executing the task -->
+            <staging:stageRemotely description="@{artifactId} ${version.id}">
+                <staging:nexusStagingInfo stagingDirectory="build/nexus-stage/@{artifactId}">
                     <staging:projectInfo groupId="org.apache.poi" artifactId="@{artifactId}" version="${version.id}" />
-                    <staging:connectionInfo baseUrl="https://repository.apache.org">
+                    <staging:connectionInfo baseUrl="https://repository.apache.org/">
                         <staging:authentication username="${settings.apache-id.username}" password="${settings.apache-id.password}" />
                     </staging:connectionInfo>
                 </staging:nexusStagingInfo>
@@ -2004,16 +2062,6 @@ under the License.
         </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>
-
     <target name="-init-svn" depends="init,fetch-svn-jars,load-maven-server-settings">
         <!-- JAVA_HOME needs to point to a JRE/JDK7+, otherwise the svn/https connection throws a "Could not generate DH keypair"-->
         <fail message="Environment needs to point to a java 7+">