[GRADLE-1440] eclipse plugin creates incorrect project dependencies when projectName overridden Created: 11/Mar/11  Updated: 04/Jan/13  Resolved: 11/Mar/11

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-1
Fix Version/s: 1.0-milestone-2

Type: Bug
Reporter: Szczepan Faber Assignee: Szczepan Faber
Resolution: Fixed Votes: 0


 Description   

Eclipse plugin creates incorrect project dependencies in .classpath files. It happens in non-trivial, multi-module projects when user configures the projectName property of eclipseProject. For example:

project(':someProject')
  eclipseProject {
    projectName = 'betterNameForTheProject'
  }
}


 Comments   
Comment by John Burbridge [ 30/Apr/11 ]

The status for this bug is resolved and says the fix applies to 1.0-milestone-2, however I'm running into this same issue still on 1.0-milestone-3.

Here's what I've got (relevant bits only):

rootProject
|- projectA
\- projectB
projectA/build.gradle
  eclipseProject { 
      projectName = 'foo' 
  }
projectB/build.gradle
  eclipseProject { 
      projectName = 'bar' 
  }

  dependencies {
    compile project(':projectA');
  }

When generating the eclipse project for projectB, it is correctly name 'bar' but references a missing projectA, which is not correct because the project name was set to 'foo'.

Comment by Peter Niederwieser [ 30/Apr/11 ]

The Eclipse plugin is now configured like this (although the old way is apparently still supported):

eclipse {
  project {
    name = "foo"
  }
}

Does this solve your problem?

Comment by John Burbridge [ 01/May/11 ]

Thanks Peter, that did the trick!

Comment by Szczepan Faber [ 01/May/11 ]

>When generating the eclipse project for projectB, it is correctly name 'bar' but references a missing projectA, which is not correct because the project name was set to 'foo'.

I think the problem manifested itself because you have generated the eclipse file for a single, specific subproject, right? For example: you change the eclipse project name of project A. Now you need to also generate the files for all projects that depend on A so that their dependencies are updated.

>Thanks Peter, that did the trick!

Cool I bet you have ran the gradle eclipse from the root and that's the reason it worked. The previous way of configuring eclipse (via eclipseProject) should do as well.

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