Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing generated eclipse projects results in build path errors #4172

Closed
epeee opened this issue Jan 26, 2018 · 6 comments
Closed

Importing generated eclipse projects results in build path errors #4172

epeee opened this issue Jan 26, 2018 · 6 comments

Comments

@epeee
Copy link
Contributor

epeee commented Jan 26, 2018

Expected Behavior

Running ./gradlew eclipse and importing the generated projects should not end up in build path errors.

Current Behavior

Running ./gradlew eclipse and importing the generated projects ends up in:
"Cannot nest 'projA/src/main/java' inside 'projA'. To enable the nesting exclude 'src/' from 'projA''" Build Path Problem.

Context

It looks like this one was introduced in Gradle 4.5. Using Gradle 4.4.1 the generated project can be imported to Eclipse without any errors.
This one is a minor one which can be fixed easily in the build.gradle file, but it might break some builds which are out there.

Steps to Reproduce

This can be reproduced by having a settings.gradle like

include 'projA'
include 'projB'

and a build.gradle like

subprojects {
    apply plugin: 'java'
    apply plugin: 'eclipse'

    dependencies {
        testCompile project(':projA')
    }
}

In order to use Gradle 4.5 we are adding the testCompile project(':projA') dependency only if the subproject is not 'projA'.

self-contained example: https://github.com/epeee/gradle-4172.

epeee added a commit to epeee/gradle-4172 that referenced this issue Jan 26, 2018
@bmuschko
Copy link
Contributor

@donat Could you please look into this?

@donat
Copy link
Member

donat commented Jan 30, 2018

This is probably related to the recent changes in the dependency resolution engine.

@jjohannes jjohannes self-assigned this Jan 30, 2018
@jjohannes
Copy link
Contributor

This is caused by a change in #3625.

The changes in #3625 are quite involved. So I don't know exactly what caused this. @oehme maybe you can have a look at his?

In the example, the new behavior adds <classpathentry kind="src" path="/projA"/> to the .classpath of projA which depends on itself. This then leads to the error.

@jjohannes jjohannes removed their assignment Jan 30, 2018
@oehme
Copy link
Contributor

oehme commented Jan 30, 2018

@donat Could you fix the EclipseDependencyCreator? I forgot the self-dependency check like in the IDEA plugin. This means we are missing test coverage. You might want to double-check other implementations of IdeDependencyVisitor.

@epeee
Copy link
Contributor Author

epeee commented Jan 31, 2018

@oehme thx for the hint! I can confirm that the generated project can be imported without errors again after applying your fix (building gradle locally using fixes from https://github.com/epeee/gradle/tree/gradle-4172).
I have not checked other implementations of IdeDependencyVisitor though.

@oehme oehme added this to the 4.5.1 milestone Feb 2, 2018
@oehme
Copy link
Contributor

oehme commented Feb 2, 2018

@donat Since we're doing a patch release anyway, we should fix this there as well. The release is on Monday, so could you look into this today? If not I'll try to free up some time.

@oehme oehme closed this as completed Feb 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants