Ant integration: taskdef RakeImport doesn't import targets into rake if called
from within a target
---------------------------------------------------------------------------------------------------
Key: JRUBY-4924
URL: http://jira.codehaus.org/browse/JRUBY-4924
Project: JRuby
Issue Type: Bug
Components: Java Integration
Affects Versions: JRuby 1.5.1
Reporter: Rustbear
Priority: Minor
Background: the aim was to replace an ant build script with a JRuby rake script
within an ant multiproject configuration (where there is a master build xml,
which imports other build xmls lying in subfolders).
Problem: when invoking the ant taskdef target with org.jruby.ant.RakeImport
from within a target, not at the project level, then the rake tasks are not
picked up in the script. An example of this setup is below:
build.xml
~~~~~~~~~
<?xml version="1.0" encoding="UTF-8"?>
<project name="foobar" default="top-level" basedir=".">
<description>Builds, tests, and runs the project foobar.</description>
<target name="init">
<taskdef name="rakeimport" classname="org.jruby.ant.RakeImport"/>
<rakeimport/>
</target>
<target name="top-level" depends="init">
<antcall target="its_in.rake"/>
</target>
<target name="its_in_ant">
<echo message="ant: its_in_ant"/>
</target>
</project>
Rakefile
~~~~~~~~
task "its_in.rake" => ["task.setup", :its_in_ant] do
puts "it's in Rake"
end
task "task.setup" do
puts ant.project.get_property("ant.project.name")
puts "setup in Rake"
end
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is not possible to place the taskdef at the project level, because if this
is done, then the taskdef will be reloaded over and over during the build
process (see this blog post:
http://raibledesigns.com/rd/entry/ant_trying_to_override_old) until the build
dies from a PermGen OutOfMemoryException.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email