You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rusty Wright <ru...@gmail.com> on 2009/06/15 21:06:14 UTC

hibernate3-maven-plugin runs in the wrong project

In the parent project, when I run mvn -Plocalhost-hsql package, for example, it runs the hibernate3 plugin which generates the database, using an embedded hsql database.  It's running the database generation in the parent project's directory and creating the files there, but the tests in the database project that use that database are running in the database project's directory.  The database file that hsql uses and was created is in the parent project's target directory and, it seems to me, should be in the target directory of the database project.

After the hibernate3 plugin runs my directories look like this:

  waitlist-parent/
      target/
          database.script (it's really waitlist.script)
          database.properties (it's really waitlist.properties)

  waitlist-db/
      target/
          (no database files)

I want it to run the database creation stuff only when I specify the localhost-hsql profile.  Is it possible to set this up?  I'm hoping that I'm not doing something correctly.


The database project's pom file starts like this:

<project
    xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://maven.apache.org/POM/4.0.0
        http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>waitlist-parent</artifactId>
        <groupId>edu.berkeley.ist.waitlist</groupId>
        <version>1.1-SNAPSHOT</version>
        <relativePath>../waitlist-parent/pom.xml</relativePath>
    </parent>

    <artifactId>waitlist-db</artifactId>

    <packaging>jar</packaging>


And ends with a profile with a build section to do the database generation (in the middle of the pom is a <build><plugins><plugin> section that configures the hibernate3 plugin):


    <profiles>
        <profile>
            <id>localhost-hsql</id>

            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>

            <properties>
                <db2.url>jdbc:hsqldb:file:target/waitlist;shutdown=true</db2.url>
                <db2.user>sa</db2.user>
                <db2.password />
                <jdbc-db2.driverClass>org.hsqldb.jdbcDriver</jdbc-db2.driverClass>
                <db2.schema>public</db2.schema>
                <db2.hibernate.dialect>org.hibernate.dialect.HSQLDialect</db2.hibernate.dialect>
                <hbmtool.haltOnError>false</hbmtool.haltOnError>
            </properties>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>hibernate3-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>process-classes</phase>
                                <goals>
                                    <goal>hbm2ddl</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org