0

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>
  • Is a `com.Database Project` artifact a maven plugin? I would avoid adding a space within `groupId` or `artifactId`... – Arek Jun 11 '15 at 07:10
  • it's not a maven plug-in,i just wanted to know if i can use in that way – Prince harsha Jun 11 '15 at 07:16
  • Maven is a build tool, while the settings you are trying to change is supposed to be something defined in execution time. It is not supposed to be work of Maven. Reconsider your design. – Adrian Shum Jun 11 '15 at 07:36

1 Answers1

0

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.

Community
  • 1
  • 1
Arek
  • 3,106
  • 3
  • 23
  • 32