Replace resource links with project dependencies


(Horcrux7) #1

After migrating a project to Buildship I have a large count of linked resources to other Eclipse source folders. Is it possible to convert this to project dependency?

Our Gradle script look like:

sourceSets {
    def subprojects = [ '../foo/', '../bar/', '../xyz/', '../abc/', '../etc/', ..... ]
    main {
        java {
            subprojects.each{ String pro ->
                srcDir pro + 'src'
            }
        }
    test {
        java {
            subprojects.each{ String pro ->
                srcDir pro + 'test'
            }
        }
    }
}

(Stefan Oehme) #2

You are linking subproject sources into the root project, so Buildship just does what you tell it to do.

If you want project dependencies in Eclipse, use project dependencies in Gradle.


(Horcrux7) #3

How can I do this? The other Eclipse projects does not have any Gradle settings.

I think I need to import the other projects in the settings.gradle:

include '../foo/', '../bar/', '../xyz/', '../abc/', '../etc/'

Then I need to add a build.grade to every of this subprojects like:

sourceSets {
    main {
        java {
            srcDir 'src'
        }
    test {
        java {
            srcDir pro + 'test'
        }
    }
}

And in the main project I need to change to:

sourceSets {
    def subprojects = [ '../foo/', '../bar/', '../xyz/', '../abc/', '../etc/', ..... ]
    main {
        java {
            subprojects.each{ String pro ->
                srcDir project(pro).sourceSets.main.java
            }
        }
    test {
        java {
            subprojects.each{ String pro ->
               srcDir project(pro).sourceSets.test.java
            }
        }
    }
}

Is this right?