JAXB 2.x and Ant
I am using JAXB 2.1.2 with the MOXy implementation. To build my web app I am using Ant 1.7.1 and I am also using the
package-info.java
class to specify namespace stuff.
All runs fine, except the p开发者_如何学Cackage-info.java does not get compiled. in the build directory, there is no expected package-info.class at the dedicated directory (with my domain classes).
How can I force Ant to also compile the package-info.java class?
I read about Ant's limitation here but I can't believe that this has not been resolved? http://ant.apache.org/manual/Tasks/javac.html
Thanks
In the meanwhile I found a workaround myself, so this works fine but only if you compile twice (somehow the target folder where the class file gets stored to must be older than the package-info.java file): Instead of these ant commands in my build.xml:
<mkdir dir="${realm.classes.dir}"/>
<javac srcdir="${realm.java.dir}" destdir="${realm.classes.dir}"
classpathref="classpath"
encoding="${javac.encoding}"
debug="true"
/>
I had to use the additional command:
<mkdir dir="${realm.classes.dir}"/>
<touch>
<fileset dir="${realm.java.dir}" includes="**/package-info.java"/>
</touch>
<javac srcdir="${realm.java.dir}" destdir="${realm.classes.dir}"
classpathref="classpath"
encoding="${javac.encoding}"
debug="true"
/>
If you have a better solution, let me know!
精彩评论