What you are looking for was already answered here: Maven: include resource file based on profile
Instead of having two files, another solution would be to use properties directly inside the properties.xml:
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.username" value="${db.username}"/>
<property name="hibernate.connection.password" value="${db.password}"/>
<property name="hibernate.connection.url" value="${db.connectionURL}/database"/>
In your pom.xml, define a value for each property for each environment:
<profile>
<id>development</id>
<properties>
<db.username>dev</db.username>
<db.password>dev_password</db.password>
<db.connectionURL>http://dev:3306/</db.connectionURL>
</properties>
</profile>
<profile>
<id>production</id>
<properties>
<db.username>prod</db.username>
<db.password>prod_password</db.password>
<db.connectionURL>http://prod:3306/</db.connectionURL>
</properties>
</profile>
You could then use filtering to enable token replacement by the right value in each environement:
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
For mode details on this solution look at this page.
If you really need to have two copy of the same file, you could also use the