Problems in dependencies using maven with ecplise
<p>I do not know a lot about Maven, only the basics and that this causing me some problems.</p>

<p>I'm using Ecplise Luna with maven (the EMBEDDED version 3.2.1 / 1.5.1.50109-1819) to manage my project. also installed JBoss Tools plugin to send my project to OpenShift. So far so good.</p>

<p>However, I'm facing some errors in OpenShift and researching in forums discovered that the problem is related to the 5.0.8 version of mysql-connector-java. So I went in pom.xml file from my maven project and changed the version of mysql-connector-java 5.0.8 to 5.1.38, saved the pom and theoretically my maven should download the version the new version (5.1.38) mysql-connector-java and delete the old (5.0.8), right?
Well, if that's what should happen, it is not what is happening. I could not find any errors, but in my lib folder there is only the 5.0.8 version of mysql-connector-java.</p>

<p>Strange that when I give clean install to build is successfully generated, and MyApp-0.0.1-SNAPSHOT / WEB-INF / lib is generated mysql-connector-java-5.0.8-bin.jar file and mysql-connector -java-5.1.38.jar.</p>

<p>Why this is happening? the little I understand, the maven should not replace the 5.0.8 version for 5.1.38, since I changed the version in pom.xml?</p>

<p>Any idea what's going on?</p>

<p>My pom.xml</p>

<pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;Picos&lt;/groupId&gt;
  &lt;artifactId&gt;Picos&lt;/artifactId&gt;
  &lt;version&gt;0.0.2-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;javax.faces&lt;/groupId&gt;
      &lt;artifactId&gt;javax.faces-api&lt;/artifactId&gt;
      &lt;version&gt;2.2&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
      &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
      &lt;version&gt;3.1.0&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.primefaces&lt;/groupId&gt;
      &lt;artifactId&gt;primefaces&lt;/artifactId&gt;
      &lt;version&gt;5.2&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.primefaces.themes&lt;/groupId&gt;
      &lt;artifactId&gt;all-themes&lt;/artifactId&gt;
      &lt;version&gt;1.0.10&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;junit&lt;/groupId&gt;
      &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;version&gt;4.12&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
      &lt;version&gt;4.3.6.Final&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
      &lt;version&gt;5.2.1.Final&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;mysql&lt;/groupId&gt;
      &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
      &lt;version&gt;5.1.38&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
      &lt;artifactId&gt;gson&lt;/artifactId&gt;
      &lt;version&gt;2.3.1&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;commons-io&lt;/groupId&gt;
      &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
      &lt;version&gt;2.4&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;commons-codec&lt;/groupId&gt;
      &lt;artifactId&gt;commons-codec&lt;/artifactId&gt;
      &lt;version&gt;1.10&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;commons-fileupload&lt;/groupId&gt;
      &lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;
      &lt;version&gt;1.3.1&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
      &lt;artifactId&gt;jersey-client&lt;/artifactId&gt;
      &lt;version&gt;2.21&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
      &lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
      &lt;version&gt;2.21&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
      &lt;artifactId&gt;jersey-media-multipart&lt;/artifactId&gt;
      &lt;version&gt;2.21&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
      &lt;exclusions&gt;
        &lt;exclusion&gt;
          &lt;artifactId&gt;mimepull&lt;/artifactId&gt;
          &lt;groupId&gt;org.jvnet.mimepull&lt;/groupId&gt;
        &lt;/exclusion&gt;
      &lt;/exclusions&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.jvnet.mimepull&lt;/groupId&gt;
      &lt;artifactId&gt;mimepull&lt;/artifactId&gt;
      &lt;version&gt;1.9.6&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
      &lt;artifactId&gt;jersey-container-servlet-core&lt;/artifactId&gt;
      &lt;version&gt;2.21&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
      &lt;artifactId&gt;jackson-core-asl&lt;/artifactId&gt;
      &lt;version&gt;1.9.13&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;com.ganyo&lt;/groupId&gt;
      &lt;artifactId&gt;gcm-server&lt;/artifactId&gt;
      &lt;version&gt;1.0.2&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
      &lt;artifactId&gt;httpclient&lt;/artifactId&gt;
      &lt;version&gt;4.5.1&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;javax.enterprise&lt;/groupId&gt;
      &lt;artifactId&gt;cdi-api&lt;/artifactId&gt;
      &lt;version&gt;1.2&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;repositories&gt;
    &lt;repository&gt;
      &lt;id&gt;prime-repo&lt;/id&gt;
      &lt;name&gt;PrimeFaces Maven Repository&lt;/name&gt;
      &lt;url&gt;http://repository.primefaces.org&lt;/url&gt;
    &lt;/repository&gt;
    &lt;repository&gt;
      &lt;snapshots&gt;
        &lt;enabled&gt;false&lt;/enabled&gt;
      &lt;/snapshots&gt;
      &lt;id&gt;central&lt;/id&gt;
      &lt;name&gt;Central Repository&lt;/name&gt;
      &lt;url&gt;http://repo.maven.apache.org/maven2&lt;/url&gt;
    &lt;/repository&gt;
  &lt;/repositories&gt;
  &lt;pluginRepositories&gt;
    &lt;pluginRepository&gt;
      &lt;releases&gt;
        &lt;updatePolicy&gt;never&lt;/updatePolicy&gt;
      &lt;/releases&gt;
      &lt;snapshots&gt;
        &lt;enabled&gt;false&lt;/enabled&gt;
      &lt;/snapshots&gt;
      &lt;id&gt;central&lt;/id&gt;
      &lt;name&gt;Central Repository&lt;/name&gt;
      &lt;url&gt;http://repo.maven.apache.org/maven2&lt;/url&gt;
    &lt;/pluginRepository&gt;
  &lt;/pluginRepositories&gt;
  &lt;build&gt;
    &lt;sourceDirectory&gt;D:\Meus documentos\Projetos\Thiago\app Picos\Workspace\Picos\src&lt;/sourceDirectory&gt;
    &lt;scriptSourceDirectory&gt;D:\Meus documentos\Projetos\Thiago\app Picos\Workspace\Picos\src\main\scripts&lt;/scriptSourceDirectory&gt;
    &lt;testSourceDirectory&gt;D:\Meus documentos\Projetos\Thiago\app Picos\Workspace\Picos\src\test\java&lt;/testSourceDirectory&gt;
    &lt;outputDirectory&gt;D:\Meus documentos\Projetos\Thiago\app Picos\Workspace\Picos\target\classes&lt;/outputDirectory&gt;
    &lt;testOutputDirectory&gt;D:\Meus documentos\Projetos\Thiago\app Picos\Workspace\Picos\target\test-classes&lt;/testOutputDirectory&gt;
    &lt;resources&gt;
      &lt;resource&gt;
        &lt;directory&gt;D:\Meus documentos\Projetos\Thiago\app Picos\Workspace\Picos\src&lt;/directory&gt;
        &lt;excludes&gt;
          &lt;exclude&gt;**/*.java&lt;/exclude&gt;
        &lt;/excludes&gt;
      &lt;/resource&gt;
    &lt;/resources&gt;
    &lt;testResources&gt;
      &lt;testResource&gt;
        &lt;directory&gt;D:\Meus documentos\Projetos\Thiago\app Picos\Workspace\Picos\src\test\resources&lt;/directory&gt;
      &lt;/testResource&gt;
    &lt;/testResources&gt;
    &lt;directory&gt;D:\Meus documentos\Projetos\Thiago\app Picos\Workspace\Picos\target&lt;/directory&gt;
    &lt;finalName&gt;Picos-0.0.2-SNAPSHOT&lt;/finalName&gt;
    &lt;pluginManagement&gt;
      &lt;plugins&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
          &lt;version&gt;1.3&lt;/version&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.2-beta-5&lt;/version&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.8&lt;/version&gt;
        &lt;/plugin&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-release-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.3.2&lt;/version&gt;
        &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/pluginManagement&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
        &lt;version&gt;3.1&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;default-compile&lt;/id&gt;
            &lt;phase&gt;compile&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;compile&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
              &lt;source&gt;1.8&lt;/source&gt;
              &lt;target&gt;1.8&lt;/target&gt;
            &lt;/configuration&gt;
          &lt;/execution&gt;
          &lt;execution&gt;
            &lt;id&gt;default-testCompile&lt;/id&gt;
            &lt;phase&gt;test-compile&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;testCompile&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
              &lt;source&gt;1.8&lt;/source&gt;
              &lt;target&gt;1.8&lt;/target&gt;
            &lt;/configuration&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
        &lt;configuration&gt;
          &lt;source&gt;1.8&lt;/source&gt;
          &lt;target&gt;1.8&lt;/target&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
        &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.4&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;default-war&lt;/id&gt;
            &lt;phase&gt;package&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;war&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
              &lt;warSourceDirectory&gt;WebContent&lt;/warSourceDirectory&gt;
              &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
            &lt;/configuration&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
        &lt;configuration&gt;
          &lt;warSourceDirectory&gt;WebContent&lt;/warSourceDirectory&gt;
          &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
        &lt;artifactId&gt;maven-clean-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.5&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;default-clean&lt;/id&gt;
            &lt;phase&gt;clean&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;clean&lt;/goal&gt;
            &lt;/goals&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
        &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.6&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;default-testResources&lt;/id&gt;
            &lt;phase&gt;process-test-resources&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;testResources&lt;/goal&gt;
            &lt;/goals&gt;
          &lt;/execution&gt;
          &lt;execution&gt;
            &lt;id&gt;default-resources&lt;/id&gt;
            &lt;phase&gt;process-resources&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;resources&lt;/goal&gt;
            &lt;/goals&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
        &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.12.4&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;default-test&lt;/id&gt;
            &lt;phase&gt;test&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;test&lt;/goal&gt;
            &lt;/goals&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
        &lt;artifactId&gt;maven-install-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.4&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;default-install&lt;/id&gt;
            &lt;phase&gt;install&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;install&lt;/goal&gt;
            &lt;/goals&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
        &lt;artifactId&gt;maven-deploy-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.7&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;default-deploy&lt;/id&gt;
            &lt;phase&gt;deploy&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;deploy&lt;/goal&gt;
            &lt;/goals&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
        &lt;artifactId&gt;maven-site-plugin&lt;/artifactId&gt;
        &lt;version&gt;3.3&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;default-site&lt;/id&gt;
            &lt;phase&gt;site&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;site&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
              &lt;outputDirectory&gt;D:\Meus documentos\Projetos\Thiago\app Picos\Workspace\Picos\target\site&lt;/outputDirectory&gt;
              &lt;reportPlugins&gt;
                &lt;reportPlugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-project-info-reports-plugin&lt;/artifactId&gt;
                &lt;/reportPlugin&gt;
              &lt;/reportPlugins&gt;
            &lt;/configuration&gt;
          &lt;/execution&gt;
          &lt;execution&gt;
            &lt;id&gt;default-deploy&lt;/id&gt;
            &lt;phase&gt;site-deploy&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;deploy&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
              &lt;outputDirectory&gt;D:\Meus documentos\Projetos\Thiago\app Picos\Workspace\Picos\target\site&lt;/outputDirectory&gt;
              &lt;reportPlugins&gt;
                &lt;reportPlugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-project-info-reports-plugin&lt;/artifactId&gt;
                &lt;/reportPlugin&gt;
              &lt;/reportPlugins&gt;
            &lt;/configuration&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
        &lt;configuration&gt;
          &lt;outputDirectory&gt;D:\Meus documentos\Projetos\Thiago\app Picos\Workspace\Picos\target\site&lt;/outputDirectory&gt;
          &lt;reportPlugins&gt;
            &lt;reportPlugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-project-info-reports-plugin&lt;/artifactId&gt;
            &lt;/reportPlugin&gt;
          &lt;/reportPlugins&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;reporting&gt;
    &lt;outputDirectory&gt;D:\Meus documentos\Projetos\Thiago\app Picos\Workspace\Picos\target\site&lt;/outputDirectory&gt;
  &lt;/reporting&gt;
  &lt;profiles&gt;
    &lt;profile&gt;
      &lt;id&gt;openshift&lt;/id&gt;
      &lt;build&gt;
        &lt;finalName&gt;Picos&lt;/finalName&gt;
        &lt;plugins&gt;
          &lt;plugin&gt;
            &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.4&lt;/version&gt;
            &lt;configuration&gt;
              &lt;outputDirectory&gt;webapps&lt;/outputDirectory&gt;
              &lt;warName&gt;ROOT&lt;/warName&gt;
            &lt;/configuration&gt;
          &lt;/plugin&gt;
        &lt;/plugins&gt;
      &lt;/build&gt;
    &lt;/profile&gt;
  &lt;/profiles&gt;
&lt;/project&gt;
</code></pre>