buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Boisvert <alex.boisv...@gmail.com>
Subject Re: Calling ant task with classpath directly through Java
Date Mon, 18 Apr 2011 23:10:30 GMT
Hi Marc,

I recommend you use the classpath element support of the StaticWeaveAntTask
(see example at the bottom of
http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/tools/weaving/jpa/StaticWeaveAntTask.html
).

e.g.,
<target name="weaving" description="perform weaving." depends="define.task">
  <weave source= "c:\foo.jar" target = "c:\wovenfoo.jar"
persistenceinfo="c:\foo-containing-persistenceinfo.jar">
    <classpath>
      <pathelement path="c:\foo-dependent.jar"/>
    </classpath>
  </weave>
</target>

alex


On Mon, Apr 18, 2011 at 2:48 PM, Marc Weil <marc.weil@oracle.com> wrote:

> Hi all,
>
> I am trying to run JPA weaving (with Eclipselink) via Buildr but I'm having
> some problems getting it to recognize the classpath. I have defined a task
> as so:
>
> task 'weave_code' do
>      ant_task =
> Java.org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask.new
>      ant_task.source = _(:target, :main, :classes)
>      ant_task.target = _(:target, :main, :classes)
>      ant_task.persistenceinfo = project('war').path_to('war')
>      ant_task.logLevel = "FINEST"
>      ant_task.execute
> end
>
> The problem is that the Java classpath doesn't contain all the dependencies
> of the particular subproject where this task is both defined and invoked,
> and so I get a ton of ClassDefNotFound errors. I tried setting the classpath
> with the standard Java.classpath << STUFF; Java.load; mechanism, but Buildr
> vomits when I try to add all my projects and their dependencies to this list
> because it thinks I'm causing circular dependencies.
>
> Initially I was hoping that since I was invoking it in my subproject as
> such:
>
> compile.with ECLIPSELINK, COMMONS_LANG, JAVAX_PERSISTENCE, SLF4J_API,
> projects('common')
> compile { task('weave_code').invoke }
>
> that the classpath generated by compile.with would carry over into the Java
> call. But apparently it doesn't work that way. Does anyone know a way around
> this or have any suggestions for how I might do this?
>
> Thanks!
> Marc

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message