title: How to change hibernate.cfg.xml file path through maven when building project?
body: <p>I have Date base project as snapshot in nexus server which is using as dependency in my two web projects(test and production). but I am using two different databases for those two web projects. I want to use test data base for test web project and production data base for production web project. So I want to change hibernate configuration file path based on web project when the project is building in jenkins. My code snippet like this.</p>
  
  <p>DBUtil.java</p>
  
  <pre><code>public class DBUtils {
  private static SessionFactory sessionFactory;
  
  private DBUtils() {
  }
  
  static {
      Configuration configuration = new Configuration();
      configuration.configure("/hibenateconfigpath");
      ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
              .applySettings(configuration.getProperties()).build();
      sessionFactory = configuration.buildSessionFactory(serviceRegistry);
  }
  
  public static SessionFactory getSessionFactory() {
      return sessionFactory;
  }
  }
  </code></pre>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;repositories&gt;
      &lt;repository&gt;
          &lt;id&gt;snapshots&lt;/id&gt;
          &lt;name&gt;Snapshots&lt;/name&gt;
          &lt;url&gt;url/snapshots/&lt;/url&gt;
      &lt;/repository&gt;
  &lt;/repositories&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.my&lt;/groupId&gt;
          &lt;artifactId&gt;DBAccess&lt;/artifactId&gt;
          &lt;version&gt;0.0002-SNAPSHOT&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>Please provide any solution to this with maven profiles or what ever it is.</p>