Cannot create sourceset using main directory in Play applications


(Matthew Schmohl) #1

Hey all,

I’m trying to create a shared library that requires Play dependencies, and can be imported into other Play projects.

The Gradle Play plugin builds into build/playBinary/ instead of build/, so I’m attempting to use the main directory (src/main/java) as my sourceset in the shared project.

In order to resolve the Play dependencies in the main directory, I need to make it a sourceset. It seems, however, that the main directory is the only directory that does not work.

model {
    components {
        play {
            sources {
                java {
                    source.srcDir "additional/java" // works!!
                    source.srcDir "src/main/java" // doesn't work!!
                }
            }
        }
    }
}

Any example of a similar process is outlined `` here, but the util project shared among play projects isn’t an actually Play project, itself. Does anyone have any suggestions to circumvent this issue?

We are using gradle wrapper version 4.4, and within the Play Plugin, play 2.6.11, scala 2.12, and java 1.8.

Thanks!