If this ant script works (it does):


=++++++++++++++++++++++++++++++++++++++++++++++++++++=
  <!-- Making envirmoment variables available through env -->
  <property environment="env" />

  <!-- Define all properties for use in this ANT build file -->
  <property name="name.project" value="csmFrontEnd" />
  <property name="path.source" value="src/java" />
  <property name="path.target" value="target" />
  <property name="path.classes" value="target/classes" />
<property name="path.maven_repo" value="${env.HOME}/.maven/ repository" />


  <property name="build.compiler" value="javac1.4" />
<property name="name.dbschema" value="${path.target}/schema/$ {name.project}.schema.sql" />

  <!-- Define the classpath for use in this Ant build file -->
  <path id="classpath">
    <pathelement path="${path.classes}" />
<pathelement location="${path.maven_repo}/hibernate/jars/ hibernate-2.1.8.jar" /> <pathelement location="${path.maven_repo}/dom4j/jars/ dom4j-1.6.jar" /> <pathelement location="${path.maven_repo}/commons-logging/jars/ commons-logging-1.0.4.jar" /> <pathelement location="${path.maven_repo}/commons-collections/ jars/commons-collections-2.1.1.jar" /> <pathelement location="${path.maven_repo}/ppw-libraries/jars/ppw- persistence-II-1.2.0-3.1.jar" /> <pathelement location="${path.maven_repo}/ppw-libraries/jars/ppw- bean-V-1.0.0-1.0.jar" /> <pathelement location="${path.maven_repo}/ppw-libraries/jars/ppw- exception-I-1.0.0-2.0.jar" />
  </path>



<target name="hibernate.ddl" description="Hibernate hbm2ddl schema generation"> <echo message="Using selected libraries from Maven repository: $ {path.maven_repo}" />
    <property name="cp" refid="classpath"/>
    <echo message="Classpath: ${cp}"/>
    <echo message="Source: ${path.source}" />
    <taskdef name="schemaexport"
             classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
             classpathref="classpath" />
    <mkdir dir="${path.target}/schema" />
    <schemaexport config="${path.source}/hibernate.cfg.xml"
                  quiet="no"
                  text="yes"
                  drop="no"
                  delimiter=";"
                  output="${name.dbschema}">
    </schemaexport>
  </target>
=++++++++++++++++++++++++++++++++++++++++++++++++++++=





Why then does this maven script fail with a NullPointerException? Any ideas?





=++++++++++++++++++++++++++++++++++++++++++++++++++++=

  <goal name="hbm2ddl:prepare-filesystem"
description="Create the directory structure needed for SQL database schema (DDL) generation from Hibernate .hbm files">
    <u:available file="${maven.hbm2ddl.config.path}">
      <mkdir dir="${maven.hbm2ddl.build.dest}" />
    </u:available>
  </goal>

  <goal name="hbm2ddl:copy-hibernate-files">
    <!-- copy all xml files for inclusion in war -->
    <u:available file="${maven.hbm2ddl.config.path}">
      <echo message="Copying Hibernate files to ${maven.build.dest}" />
      <copy todir="${maven.build.dest}">
        <fileset dir="${maven.src.dir}/java">
          <include name="**/hibernate.cfg.xml" />
          <include name="**/*.hbm.xml" />
        </fileset>
      </copy>
    </u:available>
  </goal>

  <!-- Schema generation -->
  <goal name="hbm2ddl:generate"
description="Generate SQL database schema (DDL) from Hibernate .hbm files" prereqs="java:compile,hbm2ddl:copy-hibernate- files,hbm2ddl:prepare-filesystem"> <echo>Generate SQL database schema (DDL) from Hibernate .hbm files</echo>
    <echo>Hibernate config file: ${maven.hbm2ddl.config.path}</echo>
    <echo>Destination file: ${maven.hbm2ddl.dbschema.path}</echo>
    <u:available file="${maven.hbm2ddl.config.path}">
      <ant:taskdef name="schemaexport"
        classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask">
        <classpath>
          <pathelement path="${maven.build.dest}"/>
          <path refid="maven.dependency.classpath"/>
        </classpath>
      </ant:taskdef>
      <echo>Task defined</echo>
      <ant:schemaexport config="${maven.hbm2ddl.config.path}"
                        quiet="no"
                        text="yes"
                        drop="no"
                        delimiter=";"
                        output="${maven.hbm2ddl.dbschema.path}">
      </ant:schemaexport>
    </u:available>
  </goal>

=++++++++++++++++++++++++++++++++++++++++++++++++++++=


[EMAIL PROTECTED]:csmFrontEnd>maven hbm2ddl:generate
__  __
|  \/  |__ _Apache__ ___
| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
|_|  |_\__,_|\_/\___|_||_|  v. 1.0.2

build:start:

java:prepare-filesystem:

java:compile:
[echo] Compiling to /Volumes/Users/jand/Documents/eclipse/ workspace/csmFrontEnd/target/classes

hbm2ddl:copy-hibernate-files:
[echo] Copying Hibernate files to /Volumes/Users/jand/Documents/ eclipse/workspace/csmFrontEnd/target/classes

hbm2ddl:prepare-filesystem:

hbm2ddl:generate:
    [echo] Generate SQL database schema (DDL) from Hibernate .hbm files
[echo] Hibernate config file: /Volumes/Users/jand/Documents/ eclipse/workspace/csmFrontEnd/src/java/hibernate.cfg.xml [echo] Destination file: /Volumes/Users/jand/Documents/eclipse/ workspace/csmFrontEnd/target/schema/csmFrontEnd.schema.sql
    [echo] Task defined

BUILD FAILED
File...... /Volumes/Users/jand/Documents/eclipse/workspace/ppw- project-settings/maven.xml
Element... ant:schemaexport
Line...... 308
Column.... 65
java.lang.NullPointerException
Total time: 7 seconds
Finished at: Fri May 12 17:06:02 CEST 2006


=++++++++++++++++++++++++++++++++++++++++++++++++++++=


Position 308/65 is the closing '>' of the schemaexport tag.

The root cause exception:


=++++++++++++++++++++++++++++++++++++++++++++++++++++=


java.lang.NullPointerException
at net.sf.hibernate.cfg.Configuration.addResource (Configuration.java:333) at net.sf.hibernate.cfg.Configuration.doConfigure (Configuration.java:1027) at net.sf.hibernate.cfg.Configuration.doConfigure (Configuration.java:983) at net.sf.hibernate.cfg.Configuration.configure (Configuration.java:945) at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration (SchemaExportTask.java:186) at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute (SchemaExportTask.java:135)
        at org.apache.tools.ant.Task.perform(Task.java:341)
at org.apache.commons.jelly.tags.ant.AntTag.doTag (AntTag.java:185) at org.apache.commons.jelly.impl.TagScript.run (TagScript.java:279) at org.apache.commons.jelly.impl.ScriptBlock.run (ScriptBlock.java:135) at org.apache.commons.jelly.TagSupport.invokeBody (TagSupport.java:233) at org.apache.commons.jelly.tags.util.AvailableTag.doTag (AvailableTag.java:110) at org.apache.commons.jelly.impl.TagScript.run (TagScript.java:279) at org.apache.commons.jelly.impl.ScriptBlock.run (ScriptBlock.java:135) at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag (MavenGoalTag.java:79) at org.apache.maven.jelly.tags.werkz.MavenGoalTag $MavenGoalAction.performAction(MavenGoalTag.java:110)
        at com.werken.werkz.Goal.fire(Goal.java:639)
        at com.werken.werkz.Goal.attain(Goal.java:575)
at org.apache.maven.plugin.PluginManager.attainGoals (PluginManager.java:671) at org.apache.maven.MavenSession.attainGoals (MavenSession.java:263)
        at org.apache.maven.cli.App.doMain(App.java:488)
        at org.apache.maven.cli.App.main(App.java:1239)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at com.werken.forehead.Forehead.run(Forehead.java:551)
        at com.werken.forehead.Forehead.main(Forehead.java:581)


=++++++++++++++++++++++++++++++++++++++++++++++++++++=



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

Reply via email to