Using the delombok maven plugin places all my files in ‘target/generated-sources/delombok’. When I try and run the maven compiler it complains about duplicate classes so I set addOutputDirectory to false as this question recommends. The problem now is that the delombok’ed files are ignored and so the compiler complains about missing methods.
How can I tell the maven compiler plugin to ignore the default ‘src/main/java’ directory and instead to use the ‘target/generated-sources/delombok’ directory to compile from?
Running mvn compile -X produces the following output when the compiler runs:
[DEBUG] (f) compileSourceRoots = [C:\Users\Jamey.Holden\workspace\Apollo\Website\src\main\java, C:\Users\Jamey.Holden\workspace\Apollo\Website\target\generated-sources\java]
[DEBUG] (f) compilerId = javac
[DEBUG] (f) debug = true
[DEBUG] (f) encoding = UTF-8
[DEBUG] (f) failOnError = true
[DEBUG] (f) forceJavacCompilerUse = false
[DEBUG] (f) fork = false
[DEBUG] (f) generatedSourcesDirectory = C:\Users\Jamey.Holden\workspace\Apollo\Website\target\generated-sources\annotations
[DEBUG] (f) mojoExecution = org.apache.maven.plugins:maven-compiler-plugin:3.0:compile {execution: default-compile}
[DEBUG] (f) optimize = false
[DEBUG] (f) outputDirectory = C:\Users\Jamey.Holden\workspace\Apollo\Website\target\classes
[DEBUG] (f) proc = none
[DEBUG] (f) projectArtifact = ic.apollo:website:war:0.1
[DEBUG] (f) showDeprecation = false
[DEBUG] (f) showWarnings = false
[DEBUG] (f) skipMultiThreadWarning = false
[DEBUG] (f) source = 1.6
[DEBUG] (f) staleMillis = 0
[DEBUG] (f) target = 1.6
[DEBUG] (f) verbose = false
[DEBUG] (f) mavenSession = org.apache.maven.execution.MavenSession@393e6226
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@393e6226
Then further down where command line options are printed I can see that the -sourcepath argument is: -sourcepath C:\Users\Jamey.Holden\workspace\Apollo\Website\src\main\java;C:\Users\Jamey.Holden\workspace\Apollo\Website\target\generated-sources\java;
Neither of these are the delombok directory, so it’s fair enough that it can’t find all the getters and setters when it tries to compile.
UPDATE
I think I’m getting to the bottom of the problem. I was setting proc=none to prevent annotation processing, because I am using queryDSL to generate meta-entities and when this was not set to avoid annotation processing the compiler had a duplicate entities found error. Removing proc=none and the querydsl annotation processor solved the problem. Now I’ve just go to get m2e to work again.
It looks you didn’t read the documentation cause the plugin needs to be configured correctly like this which is the generate-sources life-cycle phase and afterwards the source files which have been generated will automatically be picked up by the maven-compiler-plugin.