开发者

JAXB 2.x and Ant

开发者 https://www.devze.com 2023-02-08 07:54 出处:网络
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

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!

0

精彩评论

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