0

I am trying to follow a guide explaining how to do resource filtering. I have a hibernate properties file which now has the following properties;

    <!-- db connection properties -->
    <property name="hibernate.connection.url">${hibernate.connection.url}</property>
    <property name="hibernate.connection.username">${hibernate.connection.username}</property>
    <property name="hibernate.connection.password">${hibernate.connection.password}</property>

and my maven pom has the following profiles;

<profiles>
    <profile>
        <id>DEV</id>
        <properties>
            <hibernate.connection.url>devurl:port</hibernate.connection.url>
            <hibernate.connection.username>user</hibernate.connection.username>
            <hibernate.connection.password>password</hibernate.connection.password>
        </properties>
    </profile>
    <profile>
        <id>PROD</id>
        <properties>
            <hibernate.connection.url>produrl</hibernate.connection.url>
            <hibernate.connection.username>user</hibernate.connection.username>
            <hibernate.connection.password>pass</hibernate.connection.password>
        </properties>
    </profile>
</profiles>

My maven build url in jenkins looked as follows before the changes;

clean package org.jacoco:jacoco-maven-plugin:prepare-agent install -Dmaven.test.failure.ignore=true

And I have modified this too look as follows;

clean package -P DEV org.jacoco:jacoco-maven-plugin:prepare-agent install -Dmaven.test.failure.ignore=true

It seems as though I have followed everything in the guide so something I have done above must be incorrect because when i do a build i am getting a mass of errors such as java.lang.UnsupportedOperationException: The application must supply JDBC connections. Is anyone able to see what I have done wrong?

Thanks

Biscuit128
  • 5,218
  • 22
  • 89
  • 149
  • Have you checked the properties file in your target after you build it with desired profile? If not, can you post your whole pom.xml? – theadam Sep 01 '14 at 10:12
  • did you find an answer to the question you just deleted about the system props? I was in the middle of posting an answer – Paul Samsotha Sep 01 '14 at 12:00
  • i didn't find an answer, no, i assumed i was being silly and that this would not be possible so reverted to passing in an argument from the command line instead - is it possible thne – Biscuit128 Sep 01 '14 at 12:20
  • Yes its possible. Can you [undelete it](http://stackoverflow.com/q/25604969/2587435) – Paul Samsotha Sep 01 '14 at 12:26
  • http://stackoverflow.com/questions/25604969/setting-a-system-variable-within-a-maven-profile undeleted – Biscuit128 Sep 01 '14 at 12:27

1 Answers1

0

I had not included the xml files in my filters in the pom.xml

<resource>
            <directory>resources</directory>
            <filtering>true</filtering>
            <includes>
                <include>**/*.p12</include>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
        </resource>
Biscuit128
  • 5,218
  • 22
  • 89
  • 149