> -----Original Message-----
> From: Stefan Bodewig [mailto:bode...@apache.org]
> Sent: Monday, February 01, 2010 3:16 AM
> To: user@ant.apache.org
> Subject: Re: Ant build that compiles and enhances in same build fails
> to find enhanceable classes
> 
> On 2010-01-31, KARR, DAVID (ATTCINW) <dk0...@att.com> wrote:
> 
> > I have an Ant build script whose "build" target has "compile,
> > enhance-classes" as an excerpt from its dependencies.  The "compile"
> > target writes classes to "build/classes", and "enhance-classes"
> > references a classpath variable that specifies build/classes as one
> of
> > the path elements.
> 
> > When I'm doing incremental development, without doing "ant clean" at
> any
> > point, everything works fine.  The build script compiles new changes
> and
> > the enhancer enhances the domain classes and everything deploys and
> runs
> > fine.
> 
> > If I instead do an "ant clean", then "ant compile", and then "ant",
> > everything also works fine.
> 
> > However, if I do "ant clean", and then "ant", the "compile" step
> > finishes, and then the "enhance-classes" target fails because it
> can't
> > find certain classes that the "compile" step should have compiled.
> 
> This sounds as if there was some classloader involved that cached
> information.  Ant's own ClassLoader usually doesn't, but it extends
> URLClassloader.  I know that for some JDKs Java used to drop
> directories
> from classloaders that don't exist when the classloader is created.
> 
> Can you perform an Ant clean, manually create build/classes and then
> run
> "ant"?  If this works, then it really means the directory has been
> dropped.
> 
> If it doesn't work, then we need to investigate where you create the
> <path> (and see whether you can defer creating it) and if any other
> tasks use it.

The path it uses is defined as a top-level property.  I guess that means
if I started the build after a "clean" was done, the value of the
top-level path property "looks to see" if "build/classes" exists, and
since it doesn't, it doesn't get put into the top-level property.  That
tells me if I simply defined the required path inline in the "openjpac"
task, that would evaluate that at that time, instead of using the
top-level property.  I defined it as a top-level property because I like
to define all my path properties that way, because they are often
related to each other.

I'll see if defining the path inline helps, but then I'll have to
consider which workaround I prefer.  Having to call the enhance task
through "ant-call" looks wonky, but it might be a better tradeoff than
having to define the enhance path separate from the other top-level
paths.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to