Custom location

Hi everyone,

I’m using the eclipse plugin for gradle to manage dependencies and customize the classpath of my existing web project.

By the following build script i’ve removed all the entries from classpath and added two separated source location to classpath (main and test), each one with his own output folder. Here’s my build.gradle script:

import org.gradle.plugins.ide.eclipse.model.SourceFolder 

apply plugin: "eclipse"
apply plugin: "java"

repositories { jcenter() }
dependencies { testCompile "junit:junit:4.11",

eclipse.classpath.file {
    beforeMerged { classpath -> 
            classpath.entries.removeAll { entry ->
                   entry.kind == 'src' || entry.kind == 'output'

    whenMerged {  cp ->
        cp.entries.add(new SourceFolder('src/main','/build/classes/main'))
        cp.entries.add(new SourceFolder('src/test','/build/classes/test')) 
        cp.entries.removeAll { it.kind == "output" }

Notice that there is only two dependencies. Unfortunately all other libs are put into eclipse build path manually :slight_smile:

With gradle eclipse command the eclipse project is compiled correctly.

Both this source locations (/src/main and /src/test) contains a file. When i build the project with eclipse, those files are correctly copied inside the classes/main and classes/test folder.

With this configuration i tried to launch a junit test, whose source file is contained in /src/test folder.

But logger doesn’t work.

i have executed the test with log4j in debug mode, and i verified that it cannot find file.

I put file in /WEB-INF/classes path and it works correctly :open_mouth:

Is there a way with gradle/groovy to put in custom location?

I’ve read some other topics in which someone said that the correct location is src/main/resources but i would not create this structure only for the fiile.

Thanks in advance,