buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Weil <marc.w...@oracle.com>
Subject Calling ant task with classpath directly through Java
Date Mon, 18 Apr 2011 21:48:28 GMT
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