Hello Marc,

a few remarks:
1. "#{xjcOutput}" is equivalent to xjcOutput. That should simplify your
code.
2. Why bother with mentioning local artifacts ? Do you know which jar you
need ? Are they hosted on a maven repository ?
If yes, you can do :classpath=>
Buildr.artifacts("com.sun.jaxb:jaxb:jar:1.2.3",
"com.sun.jaxb:jaxb-impl:jar:1.2.3").map(&:to_s).join(File::PATH_SEPARATOR)
Your code will work on any machine then.


On Thu, Aug 26, 2010 at 18:53, Mark Petrovic <[email protected]> wrote:

> Hi.  I'm new to Buildr, coming from Ant and Maven.  I've read the black
> Buildr book, and now I'm attempting to do some simple stuff with the JAXB
> XJC task.  Here's what I have so far:
>
> ...
>    compile :xjc
>    package :jar, :id => 'vzapi'
>
>    task :xjc do
>          begin
>          ant('xjc') do |ant|
>            xjcOutput='target/generated-sources/xjc'
>            rm_rf "#{xjcOutput}"
>            mkdir_p "#{xjcOutput}"
>
>  t=Dir.entries("#{ENV['HOME']}/tools/jaxb-ri/lib").join(File::PATH_SEPARATOR)
>            puts t
>            ant.taskdef :name=>"xjc",
> :classname=>"com.sun.tools.xjc.XJCTask", :classpath=>"#{t}"
>            ant.xjc :schema=>"src/main/resources/c.xsd",
> :destdir=>"#{xjcOutput}", :package=>"org.foo.api"
>          end
>        end
>    end
>
> where you can see my horribly clumsy, two-left-foot attempts to put
> together a classpath for the Ant taskdef.  The JAXB jars are in
> ENV['HOME']}/tools/jaxb-ri/lib/*.jar.
>
> Can someone suggest the "Buildr way" to build this classpath?  I've studied
> the examples referred to here
> http://www.mail-archive.com/[email protected]/msg01115.html but I'm
> still not quite getting it.  I'm learning Ruby as I go, having read the
> Pickaxe book, but where not a lot of it has sunk in yet.
>
> Thanks!
>
> --
> Mark Petrovic
>
>
>

Reply via email to