kelemen / netbeans-gradle-project

This project is a NetBeans plugin able to open Gradle based Java projects. The implementation is based on Geertjan Wielenga's plugin.
170 stars 57 forks source link

Generated Code (immutables.org) + NB 9.0 + gradle => "package exists in another module:" #406

Closed andreaseberhoefer closed 5 years ago

andreaseberhoefer commented 6 years ago

Hi, I would like to generate code with immutables.org via annotation-processing. Here is my build.gradle

apply plugin: 'java'
sourceCompatibility = 9

repositories {
    mavenCentral()
}

dependencies {    
    compileOnly 'org.immutables:value:2.7.3'
}

compileJava {
    options.compilerArgs += ["-s", "${buildDir}/apt"]
}

sourceSets {
    generated {
        java {
            srcDirs +=  "${buildDir}/apt"
            compileClasspath += sourceSets.main.compileClasspath
            compileClasspath += sourceSets.main.output
        }
    }
}

As you can set, I set the "-s" parameter for javac, so that the output for the annotation-processor is set to build/apt after that I set up a new SourceSet for the generated sources and can see the sources in netbeans. Until version 1.4.3 everything works good, but in version 2.0.1 I get the error "package exists in another module: immutable.gradle.test".

Thanks for your help Andreas

tcfurrer commented 6 years ago

That same error message is being discussed in #405