title: Gradle integration for eclipse keeps on changing .classpath file
body: <p>My current configuration includes a Java WAR project using gradle with the java and eclipse-wtp plugins, and the latest version of Buildship for Eclipse integration (1.0.3 till this morning and 1.0.4 right now) along with Eclipse Luna.</p>
  
  <p>After following this solution <a href="https://stackoverflow.com/a/9820317/1544713">https://stackoverflow.com/a/9820317/1544713</a> (successfully) to avoid deploying the test classes to my local server, I noticed that every time I refreshed the project or closed and opened Eclipse, the <code>.classpath</code> file and <code>.settings/org.eclipse.wst.common.component</code> were changed to their previous state, which is something I that gives me problems (deploying the test classes to the local server implies that they will fail to be loaded due to the lack of some test time dependencies, and of course an undesired behaviour).</p>
  
  <p>The content of <code>.classpath</code> is changed from (the right one):</p>
  
  <pre><code>&lt;classpathentry kind="src" output="target/test-classes" path="src/test/java"&gt;
      &lt;attributes&gt;
          &lt;attribute name="FROM_GRADLE_MODEL" value="true"/&gt;
      &lt;/attributes&gt;
  &lt;/classpathentry&gt;
  &lt;classpathentry kind="src" output="target/test-classes" path="src/test/resources"&gt;
      &lt;attributes&gt;
          &lt;attribute name="FROM_GRADLE_MODEL" value="true"/&gt;
      &lt;/attributes&gt;
  &lt;/classpathentry&gt;
  </code></pre>
  
  <p>to this undesired state:</p>
  
  <pre><code>&lt;classpathentry kind="src" path="src/test/java"&gt;
      &lt;attributes&gt;
          &lt;attribute name="FROM_GRADLE_MODEL" value="true"/&gt;
      &lt;/attributes&gt;
  &lt;/classpathentry&gt;
  &lt;classpathentry kind="src" path="src/test/resources"&gt;
      &lt;attributes&gt;
          &lt;attribute name="FROM_GRADLE_MODEL" value="true"/&gt;
      &lt;/attributes&gt;
  &lt;/classpathentry&gt;
  </code></pre>
  
  <p>And in the case of <code>.settings/org.eclipse.wst.common.component</code>, these two lines are added (which again, I don't want them to be present):</p>
  
  <pre><code>    &lt;wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/&gt;
      &lt;wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/resources"/&gt;
  </code></pre>
  
  <p>I can't figure out if it is Gradle that is changing the files or Buildship, or even Eclipse. In any case, I guess there is a way to stop this happening. I have tried many alternatives, like the following configs in build.gradle:</p>
  
  <pre><code>eclipse.classpath.file.whenMerged { cp -&gt;
      cp.entries.findAll { it.kind = "src" &amp;&amp; it.path.startsWith("src/test/") }*.output = "target/test-classes"
  }
  
  eclipse {
      wtp.component {  
          file.withXml { xml -&gt;       
              def node = xml.asNode()                     
              def wbrNodes = node.'**'.findAll { it.name() == 'wb-resource' &amp;&amp; it.'@source-path'.startsWith("/src/test/")}
              if (wbrNodes.size() &gt; 0) {
                  wbrNodes.each { n -&gt; n.parent().remove(n) }
              }                   
          }
      }
  }
  </code></pre>
  
  <p>But this configuration works erratically (sometimes it seems to work, some other times it doesn't, and actually the first piece of code that starts with eclipse.classpath.file.whenMerged never works).</p>
  
  <p>Thanks in advance.</p>