<!--
   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 name="demo1" default="retrieve-deps" xmlns:ivy="antlib:org.apache.ivy.ant">
	<condition property="ivy.home" value="${env.IVY_HOME}">
		<isset property="env.IVY_HOME" />
	</condition>
	<property name="ivy.home" value="${user.home}/.ivy" />
	<property name="ivy.jar.dir" value="${ivy.home}/jars" />
	<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />

	<target name="init-ivy">
    	<mkdir dir="${ivy.jar.dir}"/>
		<!-- download Ivy from web site so that it can be used even without any special installation -->
		<!-- use a non standard location during migration to apache -->
    	<get src="http://people.apache.org/~xavier/ivy/2.0.0-alpha-1-incubating/ivy.jar"
    		 dest="${ivy.jar.file}" usetimestamp="true"/>
    	<!-- try to load ivy here from local ivy dir, in case the user has not already dropped
    	      it into ant's lib dir (note that the latter copy will always take precedence).
    	      We will not fail as long as local lib dir exists (it may be empty) and
    	      ivy is in at least one of ant's lib dir or the local lib dir. -->
    	<path id="ivy.lib.path">
    	    <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
    	</path>
    	<taskdef resource="org/apache/ivy/ant/antlib.xml"
    	          uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
    </target>
	
	<target name="retrieve-deps" depends="init-ivy">
		<!-- we do nothing special for the settings, by default Ivy will look into the current directory
		  and check if an ivysettings.xml is available. If none is present, default settings will be used -->
		 <ivy:retrieve  organisation="org.apache.struts" 
		                module="struts2-core" 
		                revision="2.0.5" 
						conf="default"
		                inline="true"/>
	</target>
</project>
