Author: xavier
Date: Wed Nov 28 04:32:26 2007
New Revision: 598981
URL: http://svn.apache.org/viewvc?rev=598981&view=rev
Log:
review multi-project tutorial (IVY-591)
Modified:
incubator/ivy/core/trunk/src/example/multi-project/build.xml
incubator/ivy/core/trunk/src/example/multi-project/common/build.properties
incubator/ivy/core/trunk/src/example/multi-project/common/common.xml
incubator/ivy/core/trunk/src/example/multi-project/projects/console/ivy.xml
incubator/ivy/core/trunk/src/example/multi-project/projects/find/ivy.xml
incubator/ivy/core/trunk/src/example/multi-project/projects/list/ivy.xml
incubator/ivy/core/trunk/src/example/multi-project/projects/size/ivy.xml
incubator/ivy/core/trunk/src/example/multi-project/projects/sizewhere/ivy.xml
incubator/ivy/core/trunk/src/example/multi-project/projects/version/ivy.xml
Modified: incubator/ivy/core/trunk/src/example/multi-project/build.xml
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/example/multi-project/build.xml?rev=598981&r1=598980&r2=598981&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/example/multi-project/build.xml (original)
+++ incubator/ivy/core/trunk/src/example/multi-project/build.xml Wed Nov 28
04:32:26 2007
@@ -19,8 +19,6 @@
<project name="all"
xmlns:ivy="antlib:org.apache.ivy.ant">
- <!-- here is the version of ivy we will use. change this property to
try a newer
- version if you want -->
<property name="ivy.jar.dir" value="${user.home}/.ivy2/jars" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
@@ -28,17 +26,17 @@
<property name="src.dir" value="src" />
- <!-- =================================
- target: install-ivy
+ <!-- =================================
+ target: load-ivy
this target is not necessary if you put ivy.jar in your ant lib
directory
if you already have ivy 1.4 in your ant lib, you can simply remove
this
- target and the dependency the 'go' target has on it
+ target
================================= -->
- <target name="install-ivy" description="--> install ivy">
- <!-- try to load ivy here from local ivy dir, in case the user has not
already dropped
+ <target name="load-ivy">
+ <!-- try to load ivy here from home 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. -->
+ We will not fail as long as ivy home lib dir exists (it may be
empty) and
+ ivy is in at least one of ant's lib dir or the ivy home lib dir.
-->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
@@ -46,16 +44,12 @@
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
- <target name="buildlist" depends="install-ivy">
+ <target name="buildlist" depends="load-ivy">
<ivy:buildlist reference="build-path">
<fileset dir="projects" includes="**/build.xml"/>
</ivy:buildlist>
</target>
- <target name="init" depends="buildlist" description="init all projects">
- <subant target="new-version" buildpathref="build-path" />
- </target>
-
<target name="publish-all" depends="buildlist"
description="compile, jar and publish all projects in
the right order">
<subant target="publish" buildpathref="build-path" />
@@ -65,7 +59,7 @@
<subant target="clean" buildpathref="build-path" />
</target>
- <target name="clean" depends="clean-all, install-ivy"
+ <target name="clean" depends="clean-all, load-ivy"
description="clean tutorial: delete repository, ivy
cache, and all projects">
<delete dir="repository"/>
<ivy:cleancache />
Modified:
incubator/ivy/core/trunk/src/example/multi-project/common/build.properties
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/example/multi-project/common/build.properties?rev=598981&r1=598980&r2=598981&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/example/multi-project/common/build.properties
(original)
+++ incubator/ivy/core/trunk/src/example/multi-project/common/build.properties
Wed Nov 28 04:32:26 2007
@@ -22,6 +22,9 @@
src.dir = ${basedir}/src
repository.dir=${common.dir}/../repository
+ivy.file = ${basedir}/ivy.xml
jar.file = ${build.dir}/${ant.project.name}.jar
main.class.name = ${ant.project.name}.Main
+
+module.version.target = 1.0
Modified: incubator/ivy/core/trunk/src/example/multi-project/common/common.xml
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/example/multi-project/common/common.xml?rev=598981&r1=598980&r2=598981&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/example/multi-project/common/common.xml
(original)
+++ incubator/ivy/core/trunk/src/example/multi-project/common/common.xml Wed
Nov 28 04:32:26 2007
@@ -18,19 +18,44 @@
-->
<project name="common"
xmlns:ivy="antlib:org.apache.ivy.ant">
- <!-- a sample common build.xml file, used for ivy multi-project tutorial
+ <!-- a sample common ant build file, used for ivy multi-project tutorial
feel free to copy and adapt it to your own needs
Note that the only targets specific to ivy are:
+ load-ivy
resolve
report
+ ivy-new-version
publish
+ publish-local
+
All other targets are usual ant based targets, which could have
been written
- in a build not depending at all on ivy: the configure simply sets
some properties, resolve
- constructs a lib directory based upon ivy dependencies, and then
the lib dir is used
- as in any classical ant build
+ in a build not depending at all on ivy:
+ resolve constructs a lib directory based upon ivy dependencies,
and then the lib dir
+ is used as in any classical ant build
-->
<property file="${common.dir}/build.properties"/>
+
+ <property name="ivy.jar.dir" value="${user.home}/.ivy2/jars" />
+ <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
+
+ <!-- =================================
+ target: load-ivy
+ this target is not necessary if you put ivy.jar in your ant lib
directory
+ if you already have ivy 2.0 in your ant lib, you can simply remove
this
+ target
+ ================================= -->
+ <target name="load-ivy">
+ <!-- try to load ivy here from home 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 ivy home lib dir exists (it may be
empty) and
+ ivy is in at least one of ant's lib dir or the ivy home 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>
<path id="lib.path.id">
<fileset dir="${lib.dir}" />
@@ -46,18 +71,19 @@
<property name="ivy.shared.default.root"
value="${repository.dir}/shared"/>
<!-- here is how we would have configured ivy if we had our own
ivysettings file
- <ivy:settings id="ivy.instance file="${common.dir}/ivysettings.xml" />
+ <ivy:settings file="${common.dir}/ivysettings.xml" id="ivy.instance" />
-->
<!-- =================================
target: resolve
================================= -->
- <target name="resolve" depends="clean-lib" description="--> retrieve
dependencies with ivy">
+ <target name="resolve" depends="clean-lib, load-ivy" description="-->
resolve and retrieve dependencies with ivy">
<mkdir dir="${lib.dir}"/> <!-- not usually necessary, ivy creates the
directory IF there are dependencies -->
- <!-- this target is named resolve even if we do a retrieve:
- in fact a resolve will be called, and then the retrieve will
simply copy files in the lib directory -->
- <ivy:retrieve pattern="${lib.dir}/[artifact].[ext]" />
+
+ <!-- the call to resolve is not mandatory, retrieve makes an implicit
call if we don't -->
+ <ivy:resolve file="${ivy.file}"/>
+ <ivy:retrieve pattern="${lib.dir}/[artifact].[ext]" />
</target>
<!-- =================================
@@ -81,27 +107,31 @@
<target name="run" depends="version, compile" description="--> compile and
run the project">
<java classpathref="run.path.id" classname="${main.class.name}"/>
</target>
-
- <target name="new-version">
- <propertyfile file="${basedir}/version.properties">
- <entry key="version" type="int" operation="+" default="0" />
- </propertyfile>
- </target>
- <target name="check-version">
- <!-- test existence of version file -->
- <available file="${basedir}/version.properties"
property="version.exists"/>
- </target>
+ <target name="ivy-new-version" depends="load-ivy"
unless="ivy.new.revision">
+ <!-- default module version prefix value -->
+ <property name="module.version.prefix"
value="${module.version.target}-dev-b" />
+
+ <!-- asks to ivy an available version number -->
+ <ivy:info file="${ivy.file}" />
+ <ivy:buildnumber
+ organisation="${ivy.organisation}" module="${ivy.module}"
+ revision="${module.version.prefix}" defaultBuildNumber="1"
revSep=""/>
+ </target>
- <target name="init-version" depends="check-version"
unless="version.exists">
- <!-- init version file if it doesn't exist -->
- <echo message="version=1" file="${basedir}/version.properties"
/>
+ <target name="local-version">
+ <tstamp>
+ <format property="now" pattern="yyyyMMddHHmmss"/>
+ </tstamp>
+ <property name="ivy.new.revision"
value="${module.version.target}-local-${now}"/>
</target>
-
- <target name="version" depends="init-version">
- <!-- copy version file in classpath for later inclusion in jar -->
+
+ <target name="version" depends="ivy-new-version">
+ <!-- create version file in classpath for later inclusion in jar -->
<mkdir dir="${classes.dir}"/>
- <copy file="${basedir}/version.properties"
tofile="${classes.dir}/${ant.project.name}.properties" overwrite="true" />
+ <echo message="version=${ivy.new.revision}"
file="${classes.dir}/${ant.project.name}.properties" append="false" />
+
+ <!-- load generated version properties file -->
<property file="${classes.dir}/${ant.project.name}.properties" />
</target>
@@ -111,51 +141,43 @@
<target name="jar" depends="version, compile" description="--> make a jar
file for this project">
<jar destfile="${jar.file}">
<fileset dir="${classes.dir}" />
+ <manifest>
+ <attribute name="Built-By" value="${user.name}"/>
+ <attribute name="Build-Version" value="${version}" />
+ </manifest>
</jar>
</target>
<!-- =================================
target: publish
================================= -->
- <target name="publish" depends="clean-build, new-version, jar"
description="--> publish this project in the ivy repository">
- <property name="revision" value="${version}"/>
+ <target name="publish" depends="clean-build, jar" description="--> publish
this project in the ivy repository">
<ivy:publish artifactspattern="${build.dir}/[artifact].[ext]"
resolver="shared"
- pubrevision="${revision}"
+ pubrevision="${version}"
status="release"
/>
- <echo message="project ${ant.project.name} released with version
${revision}" />
- </target>
-
- <target name="local-version">
- <tstamp>
- <format property="now" pattern="yyyyMMddHHmmss"/>
- </tstamp>
- <property name="revision" value="local-${now}"/>
- <!-- used only to create a local version and put the corresponding file
in the jar so that it will be displayed by the module -->
- <mkdir dir="${classes.dir}"/>
- <echo message="version=${revision}"
file="${classes.dir}/${ant.project.name}.properties" append="false" />
- <property file="${classes.dir}/${ant.project.name}.properties" />
+ <echo message="project ${ant.project.name} released with version
${version}" />
</target>
<!-- =================================
target: publish-local
================================= -->
<target name="publish-local" depends="local-version, jar" description="-->
publish this project in the local ivy repository">
- <delete file="${build.dir}/ivy.xml"/> <!-- delete last produced
ivy file to be sure a new one will be generated -->
<ivy:publish artifactspattern="${build.dir}/[artifact].[ext]"
- resolver="local"
- pubrevision="${revision}"
- pubdate="${now}"
- status="integration"
+ resolver="local"
+ pubrevision="${version}"
+ pubdate="${now}"
+ status="integration"
+ forcedeliver="true"
/>
- <echo message="project ${ant.project.name} published locally with
version ${revision}" />
+ <echo message="project ${ant.project.name} published locally with
version ${version}" />
</target>
<!-- =================================
target: clean-local
================================= -->
- <target name="clean-local" description="cleans the local repository for
the current module">
+ <target name="clean-local" description="--> cleans the local repository
for the current module">
<delete dir="${ivy.local.default.root}/${ant.project.name}"/>
</target>
@@ -176,7 +198,5 @@
<!-- =================================
target: clean
================================= -->
- <target name="clean" depends="clean-build, clean-lib" description="-->
clean the project and reset version number">
- <delete file="${basedir}/version.properties"/>
- </target>
+ <target name="clean" depends="clean-build, clean-lib" description="-->
clean the project" />
</project>
Modified:
incubator/ivy/core/trunk/src/example/multi-project/projects/console/ivy.xml
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/example/multi-project/projects/console/ivy.xml?rev=598981&r1=598980&r2=598981&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/example/multi-project/projects/console/ivy.xml
(original)
+++ incubator/ivy/core/trunk/src/example/multi-project/projects/console/ivy.xml
Wed Nov 28 04:32:26 2007
@@ -18,7 +18,7 @@
-->
<ivy-module version="1.0">
<info
- organisation="org.apache"
+ organisation="org.apache.ivy.example"
module="console"
status="integration"/>
<dependencies>
Modified:
incubator/ivy/core/trunk/src/example/multi-project/projects/find/ivy.xml
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/example/multi-project/projects/find/ivy.xml?rev=598981&r1=598980&r2=598981&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/example/multi-project/projects/find/ivy.xml
(original)
+++ incubator/ivy/core/trunk/src/example/multi-project/projects/find/ivy.xml
Wed Nov 28 04:32:26 2007
@@ -18,7 +18,7 @@
-->
<ivy-module version="1.0">
<info
- organisation="org.apache"
+ organisation="org.apache.ivy.example"
module="find"
status="integration"/>
<configurations>
@@ -31,7 +31,7 @@
<dependencies>
<dependency name="version" rev="latest.integration" conf="core->default"
/>
<dependency name="list" rev="latest.integration" conf="core" />
- <dependency org="org.apache" name="commons-collections" rev="3.1"
conf="core->default" />
- <dependency org="org.apache" name="commons-cli" rev="1.0"
conf="standalone->default" />
+ <dependency org="commons-collections" name="commons-collections"
rev="3.1" conf="core->default" />
+ <dependency org="commons-cli" name="commons-cli" rev="1.0"
conf="standalone->default" />
</dependencies>
</ivy-module>
Modified:
incubator/ivy/core/trunk/src/example/multi-project/projects/list/ivy.xml
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/example/multi-project/projects/list/ivy.xml?rev=598981&r1=598980&r2=598981&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/example/multi-project/projects/list/ivy.xml
(original)
+++ incubator/ivy/core/trunk/src/example/multi-project/projects/list/ivy.xml
Wed Nov 28 04:32:26 2007
@@ -18,7 +18,7 @@
-->
<ivy-module version="1.0">
<info
- organisation="org.apache"
+ organisation="org.apache.ivy.example"
module="list"
status="integration"/>
<configurations>
@@ -30,6 +30,6 @@
</publications>
<dependencies>
<dependency name="version" rev="latest.integration" conf="core->default"
/>
- <dependency org="org.apache" name="commons-cli" rev="1.0"
conf="standalone->default" />
+ <dependency org="commons-cli" name="commons-cli" rev="1.0"
conf="standalone->default" />
</dependencies>
</ivy-module>
Modified:
incubator/ivy/core/trunk/src/example/multi-project/projects/size/ivy.xml
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/example/multi-project/projects/size/ivy.xml?rev=598981&r1=598980&r2=598981&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/example/multi-project/projects/size/ivy.xml
(original)
+++ incubator/ivy/core/trunk/src/example/multi-project/projects/size/ivy.xml
Wed Nov 28 04:32:26 2007
@@ -18,7 +18,7 @@
-->
<ivy-module version="1.0">
<info
- organisation="org.apache"
+ organisation="org.apache.ivy.example"
module="size"
status="integration"/>
<dependencies>
Modified:
incubator/ivy/core/trunk/src/example/multi-project/projects/sizewhere/ivy.xml
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/example/multi-project/projects/sizewhere/ivy.xml?rev=598981&r1=598980&r2=598981&view=diff
==============================================================================
---
incubator/ivy/core/trunk/src/example/multi-project/projects/sizewhere/ivy.xml
(original)
+++
incubator/ivy/core/trunk/src/example/multi-project/projects/sizewhere/ivy.xml
Wed Nov 28 04:32:26 2007
@@ -18,7 +18,7 @@
-->
<ivy-module version="1.0">
<info
- organisation="org.apache"
+ organisation="org.apache.ivy.example"
module="sizewhere"
status="integration"/>
<configurations>
@@ -32,6 +32,6 @@
<dependency name="version" rev="latest.integration" conf="core->default"
/>
<dependency name="size" rev="latest.integration" conf="core->default" />
<dependency name="find" rev="latest.integration" conf="core" />
- <dependency org="org.apache" name="commons-cli" rev="1.0"
conf="standalone->default" />
+ <dependency org="commons-cli" name="commons-cli" rev="1.0"
conf="standalone->default" />
</dependencies>
</ivy-module>
Modified:
incubator/ivy/core/trunk/src/example/multi-project/projects/version/ivy.xml
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/example/multi-project/projects/version/ivy.xml?rev=598981&r1=598980&r2=598981&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/example/multi-project/projects/version/ivy.xml
(original)
+++ incubator/ivy/core/trunk/src/example/multi-project/projects/version/ivy.xml
Wed Nov 28 04:32:26 2007
@@ -18,7 +18,7 @@
-->
<ivy-module version="1.0">
<info
- organisation="org.apache"
+ organisation="org.apache.ivy.example"
module="version"
status="integration"/>
</ivy-module>