Skip to content

Commit

Permalink
Switch to Maven Resolver Ant tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed May 29, 2020
1 parent d381b0b commit 1699a3d
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ mvn.properties
*.asc
*.jj
*.tmp
maven-ant-tasks-*.jar
maven-resolver-ant-tasks-*.jar
thumbs.db
Thumbs.db
bin/setenv.*
Expand Down
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,7 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform.
</and>
<filename name="**/*.asc" />
<filename name="**/*.tmp" />
<filename name="**/maven-ant-tasks-*.jar" />
<filename name="**/maven-resolver-ant-tasks-*.jar" />
<filename name="**/thumbs.db" />
<filename name="**/Thumbs.db" />
<filename name="*.launch"/>
Expand Down
68 changes: 35 additions & 33 deletions res/maven/mvn-pub.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
limitations under the License.
-->
<project name="Tomcat 10.0 Maven Deployment" default="" basedir="."
xmlns:artifact="urn:maven-artifact-ant"
xmlns:resolver="antlib:org.apache.maven.resolver.ant"
xmlns:if="ant:if"
xmlns:unless="ant:unless">
<!--
Expand All @@ -29,17 +29,17 @@

<target name="init-maven">
<antcall target="downloadfile">
<param name="sourcefile" value="${maven-ant-tasks.loc}"/>
<param name="destfile" value="${maven-ant-tasks.jar}"/>
<param name="destdir" value="${maven-ant-tasks.home}"/>
<param name="sourcefile" value="${maven-resolver-ant-tasks.loc}"/>
<param name="destfile" value="${maven-resolver-ant-tasks.jar}"/>
<param name="destdir" value="${maven-resolver-ant-tasks.home}"/>
</antcall>

<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant">
<taskdef resource="org/apache/maven/resolver/ant/antlib.xml"
uri="antlib:org.apache.maven.resolver.ant">
<classpath>
<pathelement location="${maven-ant-tasks.jar}" />
<pathelement location="${maven-resolver-ant-tasks.jar}" />
</classpath>
</typedef>
</taskdef>
</target>

<target name="maven-install" depends="init-maven">
Expand All @@ -53,9 +53,9 @@
</filterset>
</copy>

<artifact:install file="${file}">
<resolver:install file="${file}">
<pom file="${pom}.tmp"/>
</artifact:install>
</resolver:install>

<delete file="${pom}.tmp"/>
</target>
Expand Down Expand Up @@ -109,18 +109,19 @@
<param name="file.out" value="${pom}.asc" />
</antcall>

<artifact:deploy file="${file}">
<resolver:deploy>
<artifact file="${file}" />
<pom file="${pom}.tmp"/>
<remoteRepository id="${maven.repo.repositoryId}" url="${maven.repo.url}">
<remoterepo id="${maven.repo.repositoryId}" url="${maven.repo.url}">
<authentication username="${asf.ldap.username}"
password="${asf.ldap.password}"
unless:set="maven.auth.useSettings" />
</remoteRepository>
<attach file="${file}.asc" type="jar.asc" if:set="gpg.passphrase"/>
<attach file="${src}" classifier="sources" type="jar"/>
<attach file="${src}.asc" classifier="sources" type="jar.asc" if:set="gpg.passphrase"/>
<attach file="${pom}.asc" type="pom.asc" if:set="gpg.passphrase"/>
</artifact:deploy>
</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 @@ -171,16 +172,17 @@
<param name="file.out" value="${pom}.asc" />
</antcall>

<artifact:deploy file="${file}">
<resolver:deploy>
<artifact file="${file}" />
<pom file="${pom}.tmp"/>
<remoteRepository id="${maven.repo.repositoryId}" url="${maven.repo.url}">
<remoterepo id="${maven.repo.repositoryId}" url="${maven.repo.url}">
<authentication username="${asf.ldap.username}"
password="${asf.ldap.password}"
unless:set="maven.auth.useSettings"/>
</remoteRepository>
<attach file="${file}.asc" type="jar.asc" if:set="gpg.passphrase"/>
<attach file="${pom}.asc" type="pom.asc" if:set="gpg.passphrase"/>
</artifact:deploy>
</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 @@ -231,19 +233,19 @@
<param name="file.out" value="${pom}.asc" />
</antcall>

<artifact:deploy file="${pom}">
<resolver:deploy>
<pom file="${pom}.tmp"/>
<remoteRepository id="${maven.repo.repositoryId}" url="${maven.repo.url}">
<remoterepo id="${maven.repo.repositoryId}" url="${maven.repo.url}">
<authentication username="${asf.ldap.username}"
password="${asf.ldap.password}"
unless:set="maven.auth.useSettings"/>
</remoteRepository>
<attach file="${file}.zip" type="zip"/>
<attach file="${file}.zip.asc" type="zip.asc" if:set="gpg.passphrase"/>
<attach file="${file}.tar.gz" type="tar.gz"/>
<attach file="${file}.tar.gz.asc" type="tar.gz.asc" if:set="gpg.passphrase"/>
<attach file="${pom}.asc" type="pom.asc" if:set="gpg.passphrase"/>
</artifact:deploy>
</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
8 changes: 4 additions & 4 deletions res/maven/mvn.properties.default
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ tomcat.pom.path=../../res/maven
base.path=${user.home}/tomcat-build-libs

# ----- Maven Ant Tasks -----
maven-ant-tasks.version=2.1.3
maven-ant-tasks.home=${base.path}/maven-ant-tasks-${maven-ant-tasks.version}
maven-ant-tasks.loc=https://archive.apache.org/dist/maven/ant-tasks/${maven-ant-tasks.version}/binaries/maven-ant-tasks-${maven-ant-tasks.version}.jar
maven-ant-tasks.jar=${maven-ant-tasks.home}/maven-ant-tasks-${maven-ant-tasks.version}.jar
maven-resolver-ant-tasks.version=1.2.0
maven-resolver-ant-tasks.home=${base.path}/maven-resolver-ant-tasks-${maven-resolver-ant-tasks.version}
maven-resolver-ant-tasks.loc=https://repo1.maven.org/maven2/org/apache/maven/resolver/maven-resolver-ant-tasks/${maven-resolver-ant-tasks.version}/maven-resolver-ant-tasks-${maven-resolver-ant-tasks.version}-uber.jar
maven-resolver-ant-tasks.jar=${maven-resolver-ant-tasks.home}/maven-resolver-ant-tasks-${maven-resolver-ant-tasks.version}-uber.jar
5 changes: 5 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@
environment variable that defines a command to which captured stdout and
stderr will be redirected. Patch provided by Harald Dunkel. (markt)
</add>
<update>
Switch from the unsupported Maven Ant Tasks to the supported Maven
Resolver Ant Tasks to upload artifacts to the ASF Maven repository (and
from there to Maven Central). (markt)
</update>
</changelog>
</subsection>
</section>
Expand Down

0 comments on commit 1699a3d

Please sign in to comment.