blob: 9c9bcb54b83ea304af663485706f9758d0a21924 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns:resolver="antlib:org.apache.maven.resolver.ant" default="deploy">
<!--
This is an example Ant build file using the Maven Artifact Resolver Ant Tasks to compile, test, install and deploy the
maven-resolver-ant-tasks project itself. As a prerequisite, run "mvn package" first to assemble the
maven-resolver-ant-task.jar which this build file will load below.
-->
<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
<fileset dir="target" includes="maven-resolver-ant-tasks-*uber.jar"/>
</classpath>
</taskdef>
<property name="build.dir" location="target/its"/>
<resolver:localrepo dir="${build.dir}/local-repo"/>
<resolver:remoterepo id="rao" url="https://repository.apache.org/content/groups/snapshots" type="default"
releases="true" snapshots="true" updates="daily" checksums="fail"/>
<resolver:remoterepos id="resolver.repositories">
<resolver:remoterepo refid="central"/>
<resolver:remoterepo refid="rao"/>
</resolver:remoterepos>
<resolver:pom file="pom.xml" id="pom"/>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="process-resources">
<copy todir="${build.dir}/classes">
<fileset dir="src/main/resources"/>
</copy>
</target>
<target name="compile" depends="process-resources">
<mkdir dir="${build.dir}/classes"/>
<resolver:resolve>
<dependencies>
<pom refid="pom"/>
</dependencies>
<path refid="cp.compile.main" classpath="compile"/>
</resolver:resolve>
<javac classpathref="cp.compile.main" srcdir="src/main/java" destdir="${build.dir}/classes"
includeAntRuntime="false" source="7" target="7" encoding="UTF-8" fork="true"/>
</target>
<target name="process-test-resources" depends="compile">
</target>
<target name="test-compile" depends="process-test-resources">
<mkdir dir="${build.dir}/test-classes"/>
<resolver:resolve>
<dependencies>
<pom refid="pom"/>
</dependencies>
<path refid="cp.compile.test" classpath="test"/>
<path refid="cp.runtime.test" scopes="compile,runtime,test"/>
</resolver:resolve>
<path id="cp.test">
<path refid="cp.compile.test"/>
<pathelement location="${build.dir}/classes"/>
</path>
<javac classpathref="cp.test" srcdir="src/test/java" destdir="${build.dir}/test-classes"
includeAntRuntime="false" source="7" target="7" encoding="UTF-8" fork="true"/>
</target>
<target name="test" depends="test-compile">
<junit haltonfailure="true" fork="true" forkmode="once" outputtoformatters="false">
<classpath>
<pathelement location="${build.dir}/test-classes"/>
<pathelement location="${build.dir}/classes"/>
<path refid="cp.runtime.test"/>
</classpath>
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset dir="${build.dir}/test-classes" includes="**/*Test.class" excludes="**/AntBuildsTest*"/>
</batchtest>
</junit>
</target>
<target name="package" depends="test">
<jar destfile="${build.dir}/maven-resolver-ant-tasks-${pom.version}.jar" basedir="${build.dir}/classes"/>
<jar destfile="${build.dir}/maven-resolver-ant-tasks-${pom.version}-sources.jar" basedir="src/main/java"/>
<resolver:artifacts id="output">
<artifact file="${build.dir}/maven-resolver-ant-tasks-${pom.version}.jar"/>
<artifact file="${build.dir}/maven-resolver-ant-tasks-${pom.version}-sources.jar" classifier="sources"/>
</resolver:artifacts>
</target>
<target name="install" depends="package">
<resolver:install artifactsref="output"/>
</target>
<target name="deploy" depends="install">
<resolver:deploy artifactsref="output">
<remoteRepo id="dist" url="file:///${build.dir}/dist-repo"/>
</resolver:deploy>
</target>
</project>