Change the hibernate property of a database project added as a dependency to a web project

113 views Asked by At

I have a database project which is deployed to nexus server as a snapshot,which is used as a dependency in a web project.

<dependency>
                <groupId>com</groupId>
                <artifactId>DatabaseProject</artifactId>
                <version>0.0002-SNAPSHOT</version>
            </dependency>

I want to change the hibernate properties of the database project like URL,User name,password in the pom.xml file while building the web project with maven. Can it be done something like this which changes the hibernate properties or placing two different hibernate properties files and choosing which one to use.Please help me

    <plugin>
        <groupId>com</groupId>
                    <artifactId>DatabaseProject</artifactId>
                    <version>0.0002-SNAPSHOT</version>
                    <properties>
                        <property>
                            <url>url</url>
                            <username>username</username>
                            <password>password</password>
                        </property>
                    </properties>
    </plugin>
1

There are 1 answers

3
Arek On

Only plugins can have configuration, so what you've proposed is not allowed by maven. What you can do is to allow DatabaseProject to load it's configuration from ex. properties file that will be available in the classpath.

EDIT

When you're using hibernate in a standalone setup (without Spring) then consider Hibernate Tools as described here.