0

Ok I am using gradle to compile 4 sourceSets one is main and the other 3 are other small pieces of code being loaded by reflection based on the other classes available later in the "server".

so far this works

        configurations {
            extralibs
            worldguard5
            worldguard6
            worldguard613
        }
    sourceSets {
        main {
            java {
                srcDir 'src/main/java'
            }
        }
        wg5 {
            compileClasspath = configurations.worldguard5
            java {
                srcDir 'src/worldguard5/java'
            }
        }
        wg6 {
            compileClasspath = configurations.worldguard6
            java {
                srcDir 'src/worldguard6/java'
            }
        }
        wg613 {
            compileClasspath = configurations.worldguard613
            java {
                srcDir 'src/worldguard613/java'
            }
        }
dependencies {
    compile 'mysql:mysql-connector-java:5.1.13'
    compile 'org.xerial:sqlite-jdbc:3.7.2'
    compile 'com.sk89q:worldguard:6.0.0-SNAPSHOT'
    compile 'com.sk89q:worldedit:5.5.9-SNAPSHOT'
    worldguard5 sourceSets.main.output
    worldguard5 'com.sk89q:worldguard:5.9.1-SNAPSHOT'
    worldguard5 'com.sk89q:worldedit:5.5.9-SNAPSHOT'
    worldguard6 sourceSets.main.output
    worldguard6 'com.sk89q:worldguard:6.0.0-SNAPSHOT'
    worldguard6 'com.sk89q:worldedit:5.5.9-SNAPSHOT'
    worldguard613 sourceSets.wg6.output
    worldguard613 'com.sk89q.worldguard:worldguard-legacy:6.1.3-SNAPSHOT'
    worldguard613 'com.sk89q:worldedit:5.5.9-SNAPSHOT'
}

Now all works except for

worldguard613 sourceSets.wg6.output

which is giving the error

> Could not get unknown property 'worldguard6' for SourceSet container.

Any ideas?

======================================== Update It works. The accepted answer works

dependencies {
    compile fileTree(dir: 'lib', include: '*.jar')
    compile 'org.json:json:20090211'
    compile 'javax.validation:validation-api:1.1.0.Final'
    compile 'mysql:mysql-connector-java:5.1.13'
    compile 'org.xerial:sqlite-jdbc:3.7.2'
    compile 'com.sk89q:worldguard:6.0.0-SNAPSHOT'
    compile 'com.sk89q:worldedit:5.5.9-SNAPSHOT'
    worldguard5 sourceSets.main.output
    worldguard5 'com.sk89q:worldguard:5.9.1-SNAPSHOT'
    worldguard5 'com.sk89q:worldedit:5.5.9-SNAPSHOT'
    worldguard6 sourceSets.main.output
    worldguard6 'com.sk89q:worldguard:6.0.0-SNAPSHOT'
    worldguard6 'com.sk89q:worldedit:5.5.9-SNAPSHOT'
    worldguard613 sourceSets.main.output
    worldguard613 'com.sk89q.worldguard:worldguard-legacy:6.1.3-SNAPSHOT'
    worldguard613 'com.sk89q:worldedit:5.5.9-SNAPSHOT'
    testCompile 'junit:junit:4.12'
}



sourceSets {
    main {
        java {
            srcDir 'src/main/java'
        }
    }
    wg5 {
        compileClasspath = configurations.worldguard5
        java {
            srcDir 'src/worldguard5/java'
        }
    }
    wg6 {
        compileClasspath = configurations.worldguard6
        java {
            srcDir 'src/worldguard6/java'
        }
    }
    wg613 {
        compileClasspath = configurations.worldguard613 + wg6.output
        java {
            srcDir 'src/worldguard613/java'
        }
    }
}
Theresa Forster
  • 1,914
  • 3
  • 19
  • 35
  • refer this link : https://stackoverflow.com/questions/15347364/gradle-multiproject-gives-could-not-find-property-sourcesets-on-project-erro – Ali Feb 16 '18 at 15:46
  • I can't see a source set called `worldguard6`, only a source set called `wg6` and a configuration called `worldguard6`. – Lukas Körfer Feb 16 '18 at 15:53
  • Sorry mis named, but its still not working > Could not get unknown property 'wg6' for SourceSet container. I also tried the suggested worldguard613 evaluationDependsOn("sourceSets.wg6.output") but its looking for a project which i don't want to have to create as its compiling and jaring fine just not allowing the dependency on another sourceset, i need to somehow make sure 613 is after 6 – Theresa Forster Feb 16 '18 at 16:05

1 Answers1

1

Maybe try something like that :

wg613 {
    compileClasspath = configurations.worldguard613 + wg6.output
    java {
        srcDir 'src/worldguard613/java'
    }
}

and remove

worldguard613 sourceSets.wg6.output
ToYonos
  • 16,469
  • 2
  • 54
  • 70