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

Changing Eclipse Source folder output location generates duplicate classpathentries #922

Closed
SchwingSK opened this issue Nov 25, 2016 · 2 comments

Comments

@SchwingSK
Copy link

I want to change the output location to separate the test classes from my other classes.
I used the code provided in the Buildship 1.0.18 release notes (https://discuss.gradle.org/t/buildship-1-0-18-is-now-available/19012 ):

apply plugin: 'java'
apply plugin: 'eclipse'

eclipse {
    classpath {
        file {
            whenMerged {
                def src = entries.find { it.path == 'src/main/java' }
                src.output = "/$eclipse.project.name/classes/main-java"
            }
        }
    }
}

Note: I don't use Buildship; I only use the eclipse task to generate my eclipse project.

All works as expected, but when I run the eclipse task a second time, a duplicate (and invalid) classpathEntry is created, causing Eclipse to complain:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry path="bin" kind="output"/>
    <classpathentry output="/gradleSrcFolderOutput/classes/main-java" kind="src" path="src/main/java"/>
    <classpathentry kind="src" path="src/main/java"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
</classpath>

I tested this on Gradle 3.1 & 3.2.1 (on Windows 8.1, but can be reproduced on a Debian)
Here's the Build scan:
https://scans.gradle.com/s/agvrcrheznjyg

A workaround (provided by Stefan Oehme here ) is to lose the user-edited values:

beforeMerged {
  entries.clear()
}
@stale
Copy link

stale bot commented Jul 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

@stale stale bot added the stale label Jul 1, 2020
@stale
Copy link

stale bot commented Jul 22, 2020

This issue has been automatically closed due to inactivity. If you can reproduce this on a recent version of Gradle or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.

@stale stale bot closed this as completed Jul 22, 2020
@wolfs wolfs closed this as not planned Won't fix, can't repro, duplicate, stale Sep 16, 2022
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

4 participants