[GRADLE-1080] Eclipse .project merging creates significant whitespace diffs Created: 29/Jul/10  Updated: 04/Jan/13  Resolved: 16/Jan/11

Status: Resolved
Project: Gradle
Affects Version/s: 0.9.1
Fix Version/s: 0.9.2

Type: Improvement
Reporter: Chris Beams Assignee: Peter Niederwieser
Resolution: Fixed Votes: 0


 Description   

Repro steps:

  1. run gradle eclipse for the first time against a project
  2. notice resulting .project file
    <projectDescription>
      <name>
        helloworld
      </name>
      <comment/>
      <projects/>
      <natures>
        <nature>
          org.eclipse.jdt.core.javanature
        </nature>
      </natures>
      <buildSpec>
        <buildCommand>
          <name>
            org.eclipse.jdt.core.javabuilder
          </name>
          <arguments/>
        </buildCommand>
      </buildSpec>
      <links/>
    </projectDescription>
    
  3. within eclipse, add a project nature (in this case, STS's 'Spring Project Nature'
  4. notice the resulting file and it's formatting differences
    <?xml version="1.0" encoding="UTF-8"?>
    <projectDescription>
            <name>helloworld</name>
            <comment></comment>
            <projects>
            </projects>
            <buildSpec>
                    <buildCommand>
                            <name>org.eclipse.jdt.core.javabuilder</name>
                            <arguments>
                            </arguments>
                    </buildCommand>
                    <buildCommand>
                            <name>org.springframework.ide.eclipse.core.springbuilder</name>
                            <arguments>
                            </arguments>
                    </buildCommand>
            </buildSpec>
            <natures>
                    <nature>org.springframework.ide.eclipse.core.springnature</nature>
                    <nature>org.eclipse.jdt.core.javanature</nature>
            </natures>
    </projectDescription>
    
  5. assume the user checks in at this point
  6. assume the user later runs gradle eclipse again
  7. notice that the spring nature is preserved, but formatting is not
    
    


 Comments   
Comment by Chris Beams [ 29/Jul/10 ]

premature save on issue creation. step #7 above should read:

7. notice that the spring nature is preserved, but formatting is not

<projectDescription>
  <name>
    helloworld
  </name>
  <comment/>
  <projects/>
  <natures>
    <nature>
      org.springframework.ide.eclipse.core.springnature
    </nature>
    <nature>
      org.eclipse.jdt.core.javanature
    </nature>
  </natures>
  <buildSpec>
    <buildCommand>
      <name>
        org.eclipse.jdt.core.javabuilder
      </name>
      <arguments/>
    </buildCommand>
    <buildCommand>
      <name>
        org.springframework.ide.eclipse.core.springbuilder
      </name>
      <arguments/>
    </buildCommand>
  </buildSpec>
  <links/>
</projectDescription>

8. assume the user checks in once again
9. significant whitespace diffs create noise between collaborators

Ideally, Gradle's .project (and .classpath) generation facilities should generate and preserve standard eclipse formatting.

Comment by Hans Dockter [ 29/Jul/10 ]

I agree. We should observe standard eclipse formatting. It would be hard to maintain any existing custom formatting when doing the merge.

Comment by Chris Beams [ 16/Jan/11 ]

Great news that this is resolved. Thanks, Peter.

Generated at Wed Jun 30 11:46:23 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.