-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mar 2, 2005, at 18:03, Mark D. Hansen wrote:

I'm using XmlBeans to generated some Java/XML binding classes that get used in my junit tests. The way XmlBeans works, these classes end up in a jar named "xmltypes.jar".

The trick, at least for me, is to unpack the jar into the target/ directory. Some caveats for what follows. My copy of XmlBeans was built from a CVS snapshot from 2004-01-22. Also, I realize that some of the directories could be defined more portably. This works for me, and I haven't had to change it since. Note that the XSchema source files are in ${basedir}/src/schemata.


  <preGoal name="java:compile">
    <attainGoal name="xsd:compile" />
  </preGoal>

  <goal name="xsd:compile">
    <ant:taskdef name="xmlbean"
                 classname="org.apache.xmlbeans.impl.tool.XMLBean">
      <ant:classpath>
        <ant:path refid="maven.dependency.classpath" />
      </ant:classpath>
    </ant:taskdef>

    <ant:mkdir dir="${basedir}/target/classes" />

    <ant:xmlbean destfile="${basedir}/target/my-xmlbeans.jar">
      <ant:classpath>
        <ant:path refid="maven.dependency.classpath" />
      </ant:classpath>
      <ant:fileset dir="${basedir}/src/schemata">
        <ant:include name="**/*.xsd" />
      </ant:fileset>
    </ant:xmlbean>

    <ant:unjar src="${basedir}/target/my-xmlbeans.jar"
               dest="${basedir}/target/classes" />

    <ant:delete file="${basedir}/target/my-xmlbeans.jar" />
  </goal>

So, how do I get it on the junit testing classpath?

I'd guess you would want to unjar to ${basedir}/target/test-classes.

- --
Craig S. Cottingham
[EMAIL PROTECTED]
OpenPGP key available from:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7977F79C
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCJliXEJLQ3Hl395wRAq27AKCCq1V6eoUo3Fudb7xyRuKfdHwmxACgyhbk
g+hqZRtHQUYuCZdse7UAP9U=
=j/Pp
-----END PGP SIGNATURE-----


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to