Eclipse projects gets "src/main" as well as "src/main/java" as source folders

Issue #2 resolved
Anonymous created an issue

First thanks for making this plugin I've been looking for something like this for a while :) Now for the bug part:

When I use this plugin in conjunction with the gradle eclipse plugin and I regenerate the eclipse classpath with a project that has a "src/main/java" directory both "src/main/java" and "src/main" are added as source directories which naturally confuses elcipse.

This can be fixed easily by manually (or otherwise) removing "src/main" as a source directory but it would be nice to not need this step.

Once gain thanks for making the plugin, Kristian Kime

Comments (6)

  1. Kristian Kime

    Sorry should have been more clear. This doesn't have anything to do with eclipse plugins per se but rather the ".classpath" file that the eclipse gradle task generates. I'll try and give you a step by step to replicate:

    1) Create a test directory which is empty besides having "src/main/java" as sub folders.
    2) Create a build.gradle with the following contents

    apply plugin: 'java'

    apply plugin: 'eclipse'

    3) Run "gradle cleanEclipse eclipse"

    4) Verify that in ".classpath" there is an entry: <classpathentry kind="src" path="src/main/java"/> but no entry for <classpathentry kind="src" path="src/main"/>

    5) Add the following line to build.gradle

    apply from: ''

    6) Run "gradle cleanEclipse eclipse" again

    7) Verify that in ".classpath" there are entries for both: <classpathentry kind="src" path="src/main/java"/> and <classpathentry kind="src" path="src/main"/>

    This confuses eclipse when it's imported as a project since there are now nested source folders.

  2. Danno Ferrin repo owner

    This has to do with how the native blunder finds the native resource. src/main/native/package looked ugly so this was the compromise. When the deployer code goes public in the HG repos hopefully I can get patches in to allow us to tweak those knobs.

  3. Anonymous

    While waiting for a better way to prevent this, you can add this snippet in your gradle build script :

    eclipse.classpath.file {
        whenMerged { classpath ->
            classpath.entries.removeAll { entry -> entry.kind == 'src' && entry.path == 'src/main' }
  4. Log in to comment