Hi Watt,

On Feb 11, 2009, at 7:56 PM, Watt Poosanguansit wrote:

Hi Rhett,

Thank you so much for a very prompt reply. I did follow you suggestion and use this

 ant('compile-apectj') do |antp|
antTask = Antwrap::AntTask.new('compile-legacy-code', antp, {:debug => 'on', :verbose => 'no', :fork => 'no'})
        antTask.execute()
 end

You can use antp like the AntProject instance (@ant) in the Antwrap rdoc's examples. Do you have a "compile-legacy-code" ant task? If so, you need to taskdef it (just like you would in a build.xml).




I have a build.xml in the project with that task. However I still have this error:

D, [2009-02-11T19:48:23.421000 #3276] DEBUG -- : Antwrap::AntTask[compile-aspect
j]
[antlib:org.apache.tools.ant] Could not load definitions from resource org/apach
e/tools/ant/antlib.xml. It could not be found.
[Failed] Your build failed with an error: C:/Program Files/eclipse/ workspace/project:
Problem: failed to create task or type compile-legacy-code
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
buildr aborted!
←[31mProblem: failed to create task or type compile-legacy-code
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
←[0m
C:/Ruby/lib/ruby/gems/1.8/gems/Antwrap-0.7.0/lib/ant_task.rb:119:in `method_miss
ing'

I am sorry for asking such a newbie question, does Antwrap instance we get from buildr look for build.xml in the current directory like ant does?

Antwrap does not look at build.xml at all. It just allows you to use ant tasks in ruby code. (If you do need to execute something from an existing ant script, I suppose you could use ant's "ant" task via antwrap. It might be easier just to shell out and invoke ant directly at that point, though.)



Also, I hope you do not mind I ask something related to buildr building grails project. I googled but nothing really come up on the way to setup buildr to deal with grails directory structure. Thanks for your help.


I'm not familiar with grails at all, but you might want to take a look at the extending buildr section of the docs: http://buildr.apache.org/extending.html . It describes how to define different directory layouts.

Rhett



W.P.





--- On Wed, 2/11/09, Rhett Sutphin <[email protected]> wrote:

From: Rhett Sutphin <[email protected]>
Subject: Re: Flag this message Error trying to initialize Antwrap's Antproject
To: [email protected]
Date: Wednesday, February 11, 2009, 7:24 PM
Hi Watt,

On Feb 11, 2009, at 6:17 PM, Watt Poosanguansit wrote:

I am new to buildr.  I am trying to have my script
build exisiting code.  I have ant tasks that I need to
invoke.  As soon as I add in the Antwrap code:


@ant = AntProject.new()


You can use Antwrap via buildr's "ant"
helper:

ant('some_name') do |antp|
 # antp is an AntProject instance
 # Do whatever you need with it
end

If you want to use AntProject directly, you'll either
need to include the Antwrap module first:

include Antwrap

Or refer to it including its module name:

@ant = Antwrap::AntProject.new

Rhett

On Feb 11, 2009, at 6:17 PM, Watt Poosanguansit wrote:

I am new to buildr.  I am trying to have my script
build exisiting code.  I have ant tasks that I need to
invoke.  As soon as I add in the Antwrap code:


@ant = AntProject.new()

I get this error

[Failed] Your build failed with an error: C:/Program
Files/eclipse/workspace/project:
uninitialized constant AntProject
buildr aborted!
←[31muninitialized constant AntProject←[0m

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:2237:in
`const_missing'
C:/Program
Files/eclipse/workspace/TMYSWeb/buildfile:50

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:225:in
`i
nstance_eval'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:225:in
`d
efine'

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in
`call'

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in
`execute'

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in
`each'

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in
`execute'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:623:in
`e
xecute'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:190:i
n `switch_to_namespace'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:622:in
`e
xecute'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:482:i
n `invoke_with_call_chain'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:468:i
n `synchronize'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:468:i
n `invoke_with_call_chain'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:463:i
n `invoke'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/util.rb: 168:in
`__se
nd__'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/util.rb: 168:in
`to_p
roc'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:280:in
`e
ach'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:280:in
`p
rojects'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:861:in
`p
rojects'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:868

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in
`call'

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in
`execute'

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in
`each'

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in
`execute'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:482:i
n `invoke_with_call_chain'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:468:i
n `synchronize'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:468:i
n `invoke_with_call_chain'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:463:i
n `invoke'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:169:i
n `run'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:321:i
n `standard_exception_handling'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:161:i
n `run'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/bin/buildr:20
C:/Ruby/bin/buildr:19:in `load'
C:/Ruby/bin/buildr:19

C:\Program
Files\eclipse\workspace\TMYSWeb>buildr >
log.txt
buildr aborted!
uninitialized constant AntProject
C:/Program
Files/eclipse/workspace/TMYSWeb/buildfile:50
(See full trace by running task with --trace)

C:\Program
Files\eclipse\workspace\TMYSWeb>buildr >
log.txt
buildr aborted!
uninitialized constant AntProject
C:/Program
Files/eclipse/workspace/TMYSWeb/buildfile:50
(See full trace by running task with --trace)

C:\Program
Files\eclipse\workspace\TMYSWeb>buildr
--trace > log.txt
buildr aborted!
uninitialized constant AntProject

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:2237:in
`const_missing'
C:/Program
Files/eclipse/workspace/TMYSWeb/buildfile:50

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:225:in
`i
nstance_eval'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:225:in
`d
efine'

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in
`call'

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in
`execute'

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in
`each'

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in
`execute'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:623:in
`e
xecute'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:190:i
n `switch_to_namespace'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:622:in
`e
xecute'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:482:i
n `invoke_with_call_chain'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:468:i
n `synchronize'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:468:i
n `invoke_with_call_chain'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:463:i
n `invoke'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/util.rb: 168:in
`__se
nd__'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/util.rb: 168:in
`to_p
roc'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:280:in
`e
ach'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:280:in
`p
rojects'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:861:in
`p
rojects'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ project.rb:868

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in
`call'

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in
`execute'

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in
`each'

C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in
`execute'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:482:i
n `invoke_with_call_chain'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:468:i
n `synchronize'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:468:i
n `invoke_with_call_chain'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:463:i
n `invoke'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:169:i
n `run'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:321:i
n `standard_exception_handling'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/lib/buildr/core/ application.rb:161:i
n `run'

C:/Ruby/lib/ruby/gems/1.8/gems/buildr-1.3.3/bin/buildr:20
C:/Ruby/bin/buildr:19:in `load'
C:/Ruby/bin/buildr:19

I am really at a lost.  I googled but nothing came up.
Also I would appreciate if anyone can demonstrate how to
use Antwrap in buildr as well.  Again, I googled and nothing
showed up at all.


Thanks,



W.P.










Reply via email to