get-m2.xml revision 74689cbcc0cebbd857a50b155293b82d7403df78
0N/A<?xml version="1.0"?>
2362N/A
0N/A<!--
0N/A Licensed to the Apache Software Foundation (ASF) under one or more
0N/A contributor license agreements. See the NOTICE file distributed with
0N/A this work for additional information regarding copyright ownership.
2362N/A The ASF licenses this file to You under the Apache License, Version 2.0
0N/A (the "License"); you may not use this file except in compliance with
2362N/A the License. You may obtain a copy of the License at
0N/A
0N/A http://www.apache.org/licenses/LICENSE-2.0
0N/A
0N/A Unless required by applicable law or agreed to in writing, software
0N/A distributed under the License is distributed on an "AS IS" BASIS,
0N/A WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0N/A See the License for the specific language governing permissions and
0N/A limitations under the License.
0N/A-->
0N/A<!--
0N/A =======================================================================
2362N/A Build file to fetch maven2 tasks; extracted from (Ant's) fetch.xml
2362N/A =======================================================================
2362N/A-->
0N/A<project name="get-m2" default="get-m2" basedir=".">
0N/A
0N/A<description>
0N/A This build file downloads the Maven2 Ant tasks,
0N/A and installs them in the location specified by the m2.dest.dir property.
0N/A
0N/A You may need to set proxy settings. On Java1.5, Ant tries to get
0N/A this from the OS, unless you use the -noproxy option.
0N/A
0N/A Proxies can be configured manually setting the JVM proxy values in the
0N/A ANT_OPTS environment variable.
0N/A
0N/A For example, to set the proxy up in the tcsh shell, the command would be
0N/A something like:
0N/A
0N/A For csh/tcsh:
0N/A setenv ANT_OPTS "-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080"
0N/A For bash:
0N/A export ANT_OPTS="-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080"
0N/A For Windows, set the environment variable in the appropriate dialog box
0N/A and open a new console. or, by hand
0N/A set ANT_OPTS = -Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080
0N/A</description>
0N/A
0N/A <property file="get-m2.properties" />
0N/A
0N/A <property name="m2.antlib.resource"
0N/A value="org/apache/maven/artifact/ant/antlib.xml" />
0N/A
0N/A <property name="m2.antlib.uri"
0N/A value="antlib:org.apache.maven.artifact.ant" />
0N/A
0N/A <macrodef name="require">
0N/A <attribute name="property" />
0N/A <sequential>
0N/A <fail unless="@{property}">$${@{property}} not specified</fail>
0N/A </sequential>
0N/A </macrodef>
0N/A
0N/A <target name="probe-m2">
0N/A <require property="m2.dest.dir" />
0N/A <require property="m2.jar.name" />
0N/A
0N/A <!-- Look for M2 ant tasks in our classpath-->
0N/A <property name="m2.artifact" location="${m2.dest.dir}/${m2.jar.name}" />
0N/A <available property="m2.antlib.found" resource="${m2.antlib.resource}" />
0N/A <condition property="m2.antlib.typefound">
0N/A <typefound name="${m2.antlib.uri}:artifact" />
0N/A </condition>
0N/A <available property="m2.artifact.found" file="${m2.artifact}" type="file" />
0N/A </target>
0N/A
0N/A <target name="download-m2" depends="probe-m2" unless="m2.artifact.found">
0N/A <require property="m2.antlib.url" />
0N/A <echo>Downloading to ${m2.dest.dir}</echo>
0N/A
0N/A <mkdir dir="${m2.dest.dir}" />
0N/A <!-- fetch M2 ant tasks into our repository, if it is not there-->
0N/A <get src="${m2.antlib.url}"
0N/A dest="${m2.artifact}"
0N/A verbose="true"
0N/A usetimestamp="false" />
0N/A </target>
0N/A
0N/A <target name="dont-validate-m2-checksum" depends="probe-m2"
0N/A if="m2.artifact.found">
0N/A <property name="checksum.equal" value="true" />
0N/A </target>
0N/A
0N/A <target name="validate-m2-checksum"
0N/A depends="download-m2,dont-validate-m2-checksum"
0N/A if="m2.sha1.checksum" unless="m2.artifact.found">
0N/A <checksum file="${m2.artifact}"
0N/A algorithm="SHA"
0N/A property="${m2.sha1.checksum}"
0N/A verifyProperty="checksum.equal" />
0N/A </target>
0N/A
0N/A <target name="checksum-mismatch" depends="validate-m2-checksum"
0N/A if="m2.sha1.checksum" unless="checksum.equal">
0N/A <delete file="${m2.artifact}" />
0N/A <fail>
0N/A Failed to verify the downloaded file ${m2.antlib.url}" against the checksum
0N/A coded into libraries.properties.
0N/A The local copy has been deleted, for security reasons
0N/A </fail>
0N/A </target>
0N/A
0N/A <target name="checksum-match" depends="checksum-mismatch"
0N/A unless="m2.antlib.found">
0N/A <taskdef classpath="${m2.artifact}" resource="${m2.antlib.resource}"
0N/A uri="${m2.antlib.uri}" />
0N/A </target>
0N/A
0N/A <target name="get-m2" depends="checksum-match"
0N/A description="Download the Maven2 Ant tasks" />
0N/A
0N/A</project>
0N/A