Build file to fetch maven2 tasks; extracted from (Ant's) fetch.xml : Big Project Ant Script « Ant « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JavaFX
25.JDK 6
26.JDK 7
27.JNDI LDAP
28.JPA
29.JSP
30.JSTL
31.Language Basics
32.Network Protocol
33.PDF RTF
34.Reflection
35.Regular Expressions
36.Scripting
37.Security
38.Servlets
39.Spring
40.Swing Components
41.Swing JFC
42.SWT JFace Eclipse
43.Threads
44.Tiny Application
45.Velocity
46.Web Services SOA
47.XML
Java » Ant » Big Project Ant Script 




Build file to fetch maven2 tasks; extracted from (Ant's) fetch.xml



<?xml version="1.0"?>

<!--
   Licensed to the Apache Software Foundation (ASFunder 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.
-->
<!--
   Build file to fetch maven2 tasks; extracted from (Ant's) fetch.xml
-->
<project name="get-m2" default="get-m2" basedir=".">

<description>
  This build file downloads the Maven2 Ant tasks,
  and installs them in the location specified by the m2.dest.dir property.

  You may need to set proxy settings. On Java1.5, Ant tries to get
  this from the OS, unless you use the -noproxy option.

  Proxies can be configured manually setting the JVM proxy values in the
  ANT_OPTS environment variable.

  For example, to set the proxy up in the tcsh shell, the command would be
  something like:

  For csh/tcsh:
    setenv ANT_OPTS "-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080"
  For bash:
    export ANT_OPTS="-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080"
  For Windows, set the environment variable in the appropriate dialog box
  and open a new console. or, by hand
    set ANT_OPTS = -Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080
</description>

  <property file="get-m2.properties" />

  <property name="m2.antlib.resource"
            value="org/apache/maven/artifact/ant/antlib.xml" />

  <property name="m2.antlib.uri"
            value="antlib:org.apache.maven.artifact.ant" />

  <macrodef name="require">
    <attribute name="property" />
    <sequential>
      <fail unless="@{property}">$${@{property}} not specified</fail>
    </sequential>
  </macrodef>

  <target name="probe-m2">
    <require property="m2.dest.dir" />
    <require property="m2.jar.name" />

    <!-- Look for M2 ant tasks in our classpath-->
    <property name="m2.artifact" location="${m2.dest.dir}/${m2.jar.name}" />
    <available property="m2.antlib.found" resource="${m2.antlib.resource}" />
    <condition property="m2.antlib.typefound">
      <typefound name="${m2.antlib.uri}:artifact" />
    </condition>
    <available property="m2.artifact.found" file="${m2.artifact}" type="file" />
  </target>

  <target name="download-m2" depends="probe-m2" unless="m2.artifact.found">
    <require property="m2.antlib.url" />
    <echo>Downloading to ${m2.dest.dir}</echo>

    <mkdir dir="${m2.dest.dir}" />
    <!-- fetch M2 ant tasks into our repository, if it is not there-->
    <get src="${m2.antlib.url}"
      dest="${m2.artifact}"
      verbose="true"
      usetimestamp="false" />
  </target>

  <target name="dont-validate-m2-checksum" depends="probe-m2"
          if="m2.artifact.found">
    <property name="checksum.equal" value="true" />
  </target>

  <target name="validate-m2-checksum"
          depends="download-m2,dont-validate-m2-checksum"
          if="m2.sha1.checksum" unless="m2.artifact.found">
    <checksum file="${m2.artifact}"
        algorithm="SHA"
        property="${m2.sha1.checksum}"
        verifyProperty="checksum.equal" />
  </target>

  <target name="checksum-mismatch" depends="validate-m2-checksum"
          if="m2.sha1.checksum" unless="checksum.equal">
    <delete file="${m2.artifact}" />
    <fail>
      Failed to verify the downloaded file ${m2.antlib.url}" against the checksum
      coded into libraries.properties.
      The local copy has been deleted, for security reasons
    </fail>
  </target>

  <target name="checksum-match" depends="checksum-mismatch"
          unless="m2.antlib.found">
    <taskdef classpath="${m2.artifact}" resource="${m2.antlib.resource}"
             uri="${m2.antlib.uri}" />
  </target>

  <target name="get-m2" depends="checksum-match"
      description="Download the Maven2 Ant tasks" />

</project>

 














Related examples in the same category
1.Ant script for xmlgraphics-commons
2.nutch ant script
3.rhino ant build script
4.apache solr ant script
5.Tomcat ant build script
6.OFBiz ant build script
7.Apache Lenya Build System
8.Apache pivot ant build script
9.XmlSchema ant script
10.xml security
11.velocity tools ant script
12.weka build script
13.xml bean ant script
14.xml graphics common ant script
15.uPortal ant script
16.SmartGWT ant script
17.Build file to fetch optional libraries for Apache Ant
18.Ant build script
19.Build script for apache-cassandra-0.5.1-src
20.apache-log4j-site\build.xml
21.apache-roller-src-4.0.1
22.Build script from apache dbutils
23.Fop build script
24.Google guice ant script
25.GWT ant script
26.hadoop ant build script
27.jakarta jmeter ant script
28.jakarta oro ant script
29.jakarta regexp ant script
30.jedit build script
31.jibx ant build script
32.lucene ant build script
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.