I don't know if this is an Ant-specific problem, or an issue with the
PCEnhancerTask class.

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.

It's almost as if the set of classes that the enhancer task can see is
set at the start of the build, which is before those classes are made
available from the "compile" step.

At this point, I had an inspiration.  I changed the "enhance-classes"
target to "enhance-classes-sub", and then I created another target
called "enhance-classes" that just uses "antcall" to call
"enhance-classes-sub".  I then did "ant clean", and then "ant" and
everything built and deployed fine.

What exactly is going on here?

Reply via email to