Hi Ant fans,

When I run codegen, I get the error can't find DocumentException.

The class file is in the jar file C:/java/dom4j-1.6.1/dom4j-1.6.1.jar

How do I track down why the class is not being picked up.

Troy

$ ant -verbose codegen
Apache Ant version 1.7.1 compiled on June 27 2008
Buildfile: build.xml
Detected Java version: 1.6 in: c:\Program Files\Java\jdk1.6.0_06\jre
Detected OS: Windows Vista
parsing buildfile c:\java\harnassinghibernate\examples\ch01\build.xml with
URI =
file:/c:/java/harnassinghibernate/examples/ch01/build.xml
Project base dir set to: c:\java\harnassinghibernate\examples\ch01
[antlib:org.apache.tools.ant] Could not load definitions from resource
org/apach
e/tools/ant/antlib.xml. It could not be found.
parsing buildfile
jar:file:/c:/java/apache-ant-1.7.1/lib/maven-ant-tasks-2.0.9.j
ar!/org/apache/maven/artifact/ant/antlib.xml with URI =
jar:file:/c:/java/apache
-ant-1.7.1/lib/maven-ant-tasks-2.0.9.jar!/org/apache/maven/artifact/ant/antlib.x
ml
[artifact:dependencies] Maven Ant Tasks version: 2.0.9
[artifact:dependencies] Using local repository: C:\Users\Troy S\.m2\rep
ository
[artifact:dependencies] Resolving dependencies...
[artifact:dependencies] Using remote repositories:
  - id=central, url=http://repo1.maven.org/maven2, releases=enabled,
snapshots=d
isabled
  - id=central, url=http://repo1.maven.org/maven2, releases=enabled,
snapshots=d
isabled
org.apache.maven:super-pom:jar:2.0 (selected)
  hsqldb:hsqldb:jar:1.8.0.7:compile (selected)
  org.hibernate:hibernate:jar:3.2.5.ga:compile (selected)
    net.sf.ehcache:ehcache:jar:1.2.3:compile (selected)
      commons-logging:commons-logging:jar:1.0.4:compile (selected)
      commons-collections:commons-collections:jar:2.1:compile (selected)
    commons-logging:commons-logging:jar:1.0.4:compile (removed - nearer
found: 1
.0.4)
    commons-logging:commons-logging:jar:1.0.4:compile (selected)
    asm:asm-attrs:jar:1.5.3:compile (selected)
    dom4j:dom4j:jar:1.6.1:compile (selected)
    antlr:antlr:jar:2.7.6:compile (selected)
    cglib:cglib:jar:2.1_3:compile (selected)
      asm:asm:jar:1.5.3:compile (selected)
    asm:asm:jar:1.5.3:compile (removed - nearer found: 1.5.3)
    asm:asm:jar:1.5.3:compile (selected)
    commons-collections:commons-collections:jar:2.1:compile (removed -
nearer fo
und: 2.1.1)
    commons-collections:commons-collections:jar:2.1.1:compile (selected)
  org.hibernate:hibernate-tools:jar:3.2.3.GA:compile (selected)
    org.beanshell:bsh:jar:2.0b4:compile (selected)
    freemarker:freemarker:jar:2.3.8:compile (selected)
    org.hibernate:jtidy:jar:r8-20060801:compile (selected)
  org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1:compile (selected)
  log4j:log4j:jar:1.2.14:compile (selected)
dropping c:\java\harnassinghibernate\examples\ch01\classes from path as it
doesn
't exist
Build sequence for target(s) `codegen' is [codegen]
Complete build sequence is [codegen, db, print-classpath, ]

codegen:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)

BUILD FAILED
java.lang.NoClassDefFoundError: org/dom4j/DocumentException
        at
org.hibernate.tool.ant.ConfigurationTask.createConfiguration(Configur
ationTask.java:62)
        at
org.hibernate.tool.ant.ConfigurationTask.getConfiguration(Configurati

<?xml version="1.0"?>
<project name="Harnessing Hibernate 3 (Developer's Notebook Second Edition)"
        default="db" basedir="."
        xmlns:artifact="antlib:org.apache.maven.artifact.ant">

  <!-- Set up properties containing important project directories -->
  <property name="source.root" value="src"/>
  <property name="class.root" value="classes"/>
  <property name="data.dir" value="data"/>

  <artifact:dependencies pathId="dependency.class.path">
    <dependency groupId="hsqldb" artifactId="hsqldb" version="1.8.0.7"/>
    <dependency groupId="org.hibernate" artifactId="hibernate"
                version="3.2.5.ga">
      <exclusion groupId="javax.transaction" artifactId="jta"/>
    </dependency>
    <dependency groupId="org.hibernate" artifactId="hibernate-tools"
                version="3.2.3.GA"/>
    <dependency groupId="org.apache.geronimo.specs"
                artifactId="geronimo-jta_1.1_spec" version="1.1"/>
    <dependency groupId="log4j" artifactId="log4j" version="1.2.14"/>
  </artifact:dependencies>

  <!-- Set up the class path for compilation and execution -->
  <path id="project.class.path">
      <!-- Include our own classes, of course -->
      <pathelement location="${class.root}" />
      <pathelement
location="c:/java/hibernate-distribution-3.3.1.GA/hibernate3.jar" />
      <pathelement location="C:/java/hsqldb1.8.0.10/hsqldb/lib/hsqldb.jar"
/>
      <pathelement location="C:/java/dom4j-1.6.1/dom4j-1.6.1.jar" />
      <!-- Add the dependencies classpath -->
      <path refid="dependency.class.path"/>
  </path>

 
  <!-- Teach Ant how to use the Hibernate Tools -->
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="project.class.path"/>

  <target name="db" description="Runs HSQLDB database management UI
against the database file--use when application is not running">
      <java classname="org.hsqldb.util.DatabaseManager"
            fork="yes">
        <classpath refid="project.class.path"/>
        <arg value="-driver"/>
        <arg value="org.hsqldb.jdbcDriver"/>
        <arg value="-url"/>
        <arg value="jdbc:hsqldb:${data.dir}/music"/>
        <arg value="-user"/>
   
        <arg value="sa"/>
      </java>
  </target>
<!-- Generate the java code for all mapping files in our source tree -->
<target name="codegen"
description="Generate Java source from the O/R mapping files">
<hibernatetool destdir="${source.root}">
<configuration>
<fileset dir="${source.root}">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbm2java/>
</hibernatetool>
</target>
  <target name="print-classpath" description="Show the dependency class
path">
    <property name="class.path" refid="dependency.class.path"/>
    <echo>${class.path}</echo>
  </target>

</project>

-- 
View this message in context: 
http://www.nabble.com/Can%27t-find-DocumentException-tp22209309p22209309.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to