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

Generated Eclipse .classpath contains lib entries for 'build/classes/main' and 'build/resources/main' #7

Closed
kovax opened this issue Jul 14, 2015 · 2 comments
Labels
Milestone

Comments

@kovax
Copy link

kovax commented Jul 14, 2015

These 2 entries should not be added to the .classpath file of Eclipse:

@unbroken-dome unbroken-dome self-assigned this Aug 2, 2015
@unbroken-dome unbroken-dome added this to the 1.2 milestone Aug 2, 2015
@unbroken-dome
Copy link
Collaborator

This seems to be a flaw in the eclipse plugin: If you create a reference from a configuration to a source set's output like so:

dependencies {
    integrationTestCompile sourceSets.main.output
}

Then the eclipse plugin will add extra "lib" entries for the main source set to the .classpath file. This is rather silly, because that source set is already contained via "src" entries.

So until this is fixed, I included a "workaround" in the testsets-plugin that removes these superfluous entries. It is equivalent to:

eclipse {
    classpath.file.whenMerged { classpath ->
        // Get all output directories for other source sets' classes and resources.
        def outputPaths = eclipseClasspath.project.sourceSets*.output
                .collect { [ it.classesDir, it.resourcesDir ]}
                .flatten { file -> Paths.get(file as String) } as Set
        classpath.entries.removeAll { ClasspathEntry entry ->
            entry.kind == 'lib' && Paths.get(entry.path) in outputPaths
        }
    }
}

@fmance
Copy link

fmance commented Jan 9, 2019

@tkrullmann This seems to happen again for versions 2.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants