Thanks for the hint! I configured it as follows:

sourceSets {
    generated {
        java {
            srcDirs = [ 'src/generated/java' ]
        }
    }
    main {
        java {
            srcDirs = [ 'src/main/java' ]
            compileClasspath += generated.classes
        }
    }
}

That solved the compile problem but the generated and compiled files are not packaged into the jar file.

Any ideas?

---

Am 19.08.2010 um 19:52 schrieb Robert Fischer:

This just solved an issue I was having, too.  Thanks!

~~ Robert.

On 19 August 2010 12:45, Philip Crotwell <[email protected]> wrote:

This from the gradle users list might help:
http://gradle.markmail.org/thread/fiy7lycws3fmqf52

Philip


On Thu, Aug 19, 2010 at 12:33 PM, Matthias Bohlen <[email protected]> wrote:
Hi,

today, I created a separate source set for generated code:

sourceSets {
    main {
        java {
            srcDirs = [ 'src/main/java' ]
        }
    }
    generated {
        java {
            srcDirs = [ 'src/generated/java' ]
        }
    }
}

I did this because I do not want to run Checkstyle on the generated code, so I also said:

checkstyleGenerated.enabled = false

However, the compileJava task does not seem to know about the second source set because I get compile errors when a symbol is referenced that is defined in the generated code.

So: How do I add the "generated" source set to the compile and jar tasks?

Cheers
Matthias




Reply via email to