Just started playing with Ivy and EasyAnt today.
Here's a quick guide to getting started with multi-module Ant builds (because the EasyAnt Examples documentation is incomplete). This also demonstrates Ivy's ability to pull the latest version of a dependency from a repository. (And I get to finally try out Alex Gorbatchev's SyntaxHighlighter.)
1. Download:
wget http://www.easyant.org/trac/downloads/5 -O /tmp/easyant-0.5-beta1-full.zip
2. Install as root, usable by all:
sudo su;
unzip /tmp/easyant-0.5-beta1-full.zip -d /opt/easyant-0.5-beta1; \
cd /opt/easyant-0.5-beta1; \
mkdir modules repository cache; \
chmod -R g+rw *; chgrp -R users *; \
exit
3. Compile multi-module example's core jar:
export EASYANT_HOME=/opt/easyant-0.5-beta1; \
cd /opt/easyant-0.5-beta1/example/example-multimodule/example-core; \
$EASYANT_HOME/bin/easyant -p; \
$EASYANT_HOME/bin/easyant
4. Verify compiled jar:
unzip -l /opt/easyant-0.5-beta1/example/example-multimodule/example-core/target/artifacts/example-core.jar
5. Publish jar:
$EASYANT_HOME/bin/easyant repo-management:install-artifact -Dorg=org.apache.easyant \
-Dmodule=example-core -Drev=0.1 -Dartifact=target/artifacts/example-core.jar \
-Dinstall.override=true -Dto.resolver=local
6. Verify published:
unzip -l /opt/easyant-0.5-beta1/repository/org.apache.easyant/example-core/0.1/example-core.jar; \
cat /opt/easyant-0.5-beta1/repository/org.apache.easyant/example-core/0.1/example-core.ivy
<ivy-module version="1.0">
<info organisation="org.apache.easyant" module="example-core" revision="0.1"/>
</ivy-module>
7. Compile multi-module example's Hello World jar:
cd /opt/easyant-0.5-beta1/example/example-multimodule/example-hello-world; $EASYANT_HOME/bin/easyant
8. Verify compiled jar:
unzip -l /opt/easyant-0.5-beta1/example/example-multimodule/example-hello-world/target/artifacts/example-hello-world.jar
8. Run Hello World app:
cd /opt/easyant-0.5-beta1/example/example-multimodule/example-hello-world; $EASYANT_HOME/bin/easyant run:run
...
run:run:
[java] Hello World !
BUILD SUCCESSFUL
Total time: 2 seconds
9. Now, recompile the core jar, republish it as 0.2, then recompile the Hello World jar. Verify that the Hello World compilation used the newer 0.2 version instead.
cd /opt/easyant-0.5-beta1/example/example-multimodule/example-core; $EASYANT_HOME/bin/easyant; \
$EASYANT_HOME/bin/easyant repo-management:install-artifact -Dorg=org.apache.easyant \
-Dmodule=example-core -Drev=0.2 -Dartifact=target/artifacts/example-core.jar \
-Dinstall.override=true -Dto.resolver=local; unzip -l \
/opt/easyant-0.5-beta1/repository/org.apache.easyant/example-core/0.2/example-core.jar; \
cat /opt/easyant-0.5-beta1/repository/org.apache.easyant/example-core/0.2/example-core.ivy; \
cd /opt/easyant-0.5-beta1/example/example-multimodule/example-hello-world; \
$EASYANT_HOME/bin/easyant; $EASYANT_HOME/bin/easyant run:run
lib-resolve:
:: loading settings :: file = /opt/easyant-0.5-beta1/ivysettings.xml
[ivy:resolve] :: resolving dependencies :: org.apache.easyant#example-hello-world;working@x2lappy
[ivy:resolve] confs: [default, test]
[ivy:resolve] found org.apache.easyant#example-core;0.2 in local
[ivy:resolve] [0.2] org.apache.easyant#example-core;latest.revision
[ivy:resolve] :: resolution report :: resolve 30ms :: artifacts dl 1ms