Question

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 package-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

Was it helpful?

Solution

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!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top