title: Maven build error: Can not set org.apache.maven.shared.filtering.MavenResourcesFiltering field
body: <p>I am trying to create a maven project with certain dependencies of spring and hibernate. My pom.xml is fine with no errors and <code>maven install</code> runs fine with a <code>BUILD SUCCESS</code> message. However, when I try to run my projet with :- Run as-> Maven build-> clean package , it throws an exception which is: </p>
  
  <pre><code>   com.google.inject.ProvisionException: Guice provision errors:
  
  1) Error injecting: protected org.apache.maven.shared.filtering.MavenResourcesFiltering org.apache.maven.plugin.resources.ResourcesMojo.mavenResourcesFiltering
    while locating org.apache.maven.plugin.resources.ResourcesMojo
  
  1 error
      at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1006)
      at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1032)
      at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
      at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
      at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
      at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
      at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
      at org.eclipse.sisu.plexus.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:133)
      at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:109)
      at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
      at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
      at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
      at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:997)
      at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1047)
      at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:993)
      at com.google.inject.Scopes$1$1.get(Scopes.java:59)
      at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:82)
      at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
      at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:260)
      at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:252)
      at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:459)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:97)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:46)
  Caused by: java.lang.IllegalArgumentException: Can not set org.apache.maven.shared.filtering.MavenResourcesFiltering field org.apache.maven.plugin.resources.ResourcesMojo.mavenResourcesFiltering to org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering
      at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
      at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
      at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
      at java.lang.reflect.Field.set(Field.java:657)
      at org.eclipse.sisu.bean.BeanPropertyField.set(BeanPropertyField.java:72)
      at org.eclipse.sisu.plexus.ProvidedPropertyBinding.injectProperty(ProvidedPropertyBinding.java:48)
      at org.eclipse.sisu.bean.BeanInjector.injectMembers(BeanInjector.java:52)
      at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:128)
      at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:118)
      at com.google.inject.internal.ConstructorInjector.access$000(ConstructorInjector.java:32)
      at com.google.inject.internal.ConstructorInjector$1.call(ConstructorInjector.java:92)
      at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
      at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:116)
      at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
      at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90)
      at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
      at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:997)
      at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1054)
      at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:993)
      ... 42 more
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 15.502s
  [INFO] Finished at: Sun May 25 18:45:01 IST 2014
  [INFO] Final Memory: 6M/15M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project Example: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources failed: Unable to load the mojo 'resources' (or one of its required components) from the plugin 'org.apache.maven.plugins:maven-resources-plugin:2.6': com.google.inject.ProvisionException: Guice provision errors:
  [ERROR] 
  [ERROR] 1) Error injecting: protected org.apache.maven.shared.filtering.MavenResourcesFiltering org.apache.maven.plugin.resources.ResourcesMojo.mavenResourcesFiltering
  [ERROR] while locating org.apache.maven.plugin.resources.ResourcesMojo
  [ERROR] at ClassRealm[plugin&gt;org.apache.maven.plugins:maven-resources-plugin:2.6, parent: sun.misc.Launcher$AppClassLoader@35ce36]
  [ERROR] while locating org.apache.maven.plugin.Mojo annotated with @com.google.inject.name.Named(value=org.apache.maven.plugins:maven-resources-plugin:2.6:resources)
  [ERROR] 
  [ERROR] 1 error
  [ERROR] role: org.apache.maven.plugin.Mojo
  [ERROR] roleHint: org.apache.maven.plugins:maven-resources-plugin:2.6:resources: Can not set org.apache.maven.shared.filtering.MavenResourcesFiltering field org.apache.maven.plugin.resources.ResourcesMojo.mavenResourcesFiltering to org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering
  </code></pre>
  
  <p>My pom.xml is:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
    &lt;groupId&gt;Example&lt;/groupId&gt;
    &lt;artifactId&gt;Example&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
  
    &lt;name&gt;Example&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
  
  
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;3.8.1&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.mongodb&lt;/groupId&gt;
          &lt;artifactId&gt;mongo-java-driver&lt;/artifactId&gt;
          &lt;version&gt;2.10.1&lt;/version&gt;
          &lt;/dependency&gt; 
              &lt;dependency&gt;
              &lt;groupId&gt;com.googlecode.json-simple&lt;/groupId&gt;
              &lt;artifactId&gt;json-simple&lt;/artifactId&gt;
              &lt;version&gt;1.1&lt;/version&gt;
          &lt;/dependency&gt;
           &lt;dependency&gt;
              &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
              &lt;artifactId&gt;cxf-rt-frontend-jaxrs&lt;/artifactId&gt;
              &lt;version&gt;2.2.12&lt;/version&gt;
  
          &lt;/dependency&gt; 
  
              &lt;!-- Spring framework --&gt;
         &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
              &lt;version&gt;2.5.6&lt;/version&gt;
        &lt;/dependency&gt; 
        &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
          &lt;artifactId&gt;spring-data-mongodb&lt;/artifactId&gt;
          &lt;version&gt;1.0.3.RELEASE&lt;/version&gt;
      &lt;/dependency&gt; 
       &lt;dependency&gt;  
         &lt;groupId&gt;org.springframework&lt;/groupId&gt;  
         &lt;artifactId&gt;spring-core&lt;/artifactId&gt;  
         &lt;version&gt;${org.springframework.version}&lt;/version&gt;  
       &lt;/dependency&gt;  
       &lt;dependency&gt;  
         &lt;groupId&gt;org.springframework&lt;/groupId&gt;  
         &lt;artifactId&gt;spring-context&lt;/artifactId&gt;  
         &lt;version&gt;${org.springframework.version}&lt;/version&gt;  
       &lt;/dependency&gt;  
       &lt;dependency&gt;  
         &lt;groupId&gt;org.springframework&lt;/groupId&gt;  
         &lt;artifactId&gt;spring-aop&lt;/artifactId&gt;  
         &lt;version&gt;${org.springframework.version}&lt;/version&gt;  
       &lt;/dependency&gt;  
  
       &lt;dependency&gt;  
         &lt;groupId&gt;org.springframework&lt;/groupId&gt;  
         &lt;artifactId&gt;spring-context-support&lt;/artifactId&gt;  
         &lt;version&gt;${org.springframework.version}&lt;/version&gt;  
       &lt;/dependency&gt; 
       &lt;dependency&gt;  
         &lt;groupId&gt;org.springframework&lt;/groupId&gt;  
         &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;  
         &lt;version&gt;${org.springframework.version}&lt;/version&gt;  
       &lt;/dependency&gt;  
  
  
       &lt;!-- Hibernate framework --&gt;  
       &lt;dependency&gt;  
         &lt;groupId&gt;org.hibernate&lt;/groupId&gt;  
         &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;  
         &lt;version&gt;${org.hibernate.version}&lt;/version&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;${org.hibernate.version}&lt;/version&gt;  
       &lt;/dependency&gt; 
       &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;ejb3-persistence&lt;/artifactId&gt;
          &lt;version&gt;1.0.1.GA&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
        &lt;artifactId&gt;hibernate-annotations&lt;/artifactId&gt;
        &lt;version&gt;3.3.1.GA&lt;/version&gt;
      &lt;/dependency&gt; 
       &lt;!-- Hibernate library dependecy start --&gt;  
       &lt;dependency&gt;  
         &lt;groupId&gt;dom4j&lt;/groupId&gt;  
         &lt;artifactId&gt;dom4j&lt;/artifactId&gt;  
         &lt;version&gt;1.6.1&lt;/version&gt;  
       &lt;/dependency&gt;  
  
       &lt;dependency&gt;  
         &lt;groupId&gt;antlr&lt;/groupId&gt;  
         &lt;artifactId&gt;antlr&lt;/artifactId&gt;  
         &lt;version&gt;2.7.7&lt;/version&gt;  
       &lt;/dependency&gt;  
       &lt;!-- Hibernate library dependency end --&gt;  
  
  
    &lt;/dependencies&gt;
  
    &lt;properties&gt;  
  
       &lt;org.aspectj.version&gt;1.6.11&lt;/org.aspectj.version&gt;  
       &lt;!--cxf.version&gt;2.2.12&lt;/cxf.version--&gt;  
       &lt;org.hibernate.version&gt;3.6.7.Final&lt;/org.hibernate.version&gt;  
       &lt;org.springframework.version&gt;3.1.1.RELEASE&lt;/org.springframework.version&gt;  
     &lt;/properties&gt; 
  
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;java.net.2&lt;/id&gt;
              &lt;name&gt;Java Net 2 Repository&lt;/name&gt;
              &lt;url&gt;http://download.java.net/maven/2&lt;/url&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
              &lt;id&gt;apache.incubating&lt;/id&gt;
              &lt;name&gt;Apache Incubating Repository&lt;/name&gt;
              &lt;url&gt;http://people.apache.org/repo/m2-incubating-repository&lt;/url&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
              &lt;id&gt;apache.snapshot&lt;/id&gt;
              &lt;name&gt;Apache Snapshot Repository&lt;/name&gt;
              &lt;url&gt;http://people.apache.org/repo/m2-snapshot-repository&lt;/url&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
          &lt;id&gt;thirdparty-releases&lt;/id&gt;
          &lt;name&gt;JBoss Thirdparty Releases&lt;/name&gt;
          &lt;url&gt;https://repository.jboss.org/nexus/content/repositories/thirdparty-releases&lt;/url&gt;
        &lt;/repository&gt;
      &lt;/repositories&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>I am scratching my head with several issues related to maven and with this error, I have searched a lot everywhere but still I am unable to find a solution on how to resolve this. 
  Can anyone help me out please ?</p>
  
  <p>Thanks</p>