开发者

Apt task with Java 1.6?

I have some automatically generated Ant build scripts that I need to use to build an application. I am using Ant 1.8.1 and Java 1.6. The scripts use the Apt Ant task, which according to the task reference is pretty much obsolete in Java 1.6 because it can process annotations in the compiler. However, the Apt targets generate extra classes that my application needs and I haven't been able to find a way to replicate this using javac.

The problem is, when the scripts are executed, the Apt task fails complaining that it needs a JDK of 1.5+ even though I have a 1.6 JDK installed. I have tried replacing the <apt> tags with <javac> tags, copying across as many of the attributes as I can, but doing that the build falls over when looking for classes that should have been generated by the <apt> task.

I have also tried installing a 1.5 JDK and running the Ant script against that, and while the Apt task works happily, the javac tasks complain about bad class files because they were compiled in 1.6 but running against 1.5. So I completely rebuilt the source in 1.5, but still the compi开发者_如何学Pythonler complains about a bad class file, though I noticed that it did get measurably farther in the build process before this happened.

I am at my wits end and am just wondering if there is any way of getting the Apt task to play nice with Java 1.6, or indeed any other means of doing the same work as Apt with different tasks that I might have missed?


Found the solution - and it was simpler than I would have thought.

To fix the scripts, I just had to switch to an older version of Ant. Weblogic ships with Ant 1.6.5, and after pointing my ANT_HOME to this version rather than the Apache 1.8.1 the scripts ran without any complaints.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜