Skip to content

Struggling to compile java code with annotation processor produced generated-sources/ #335

@Infiniverse

Description

@Infiniverse

I've just started using groovy-eclipse-batch (with maven) for a project that also uses a java framework that makes use of an annotation processor to precompile some java classes.

Until now we've been using GMavenPlus. Switching to groovy-batch appears to work with a clean target directory, but when I run 'mvn compile' a second time it complains about classes in the generated-sources/ that were generated by an annotation processor, saying that they already exist.

Is there a simple fix for this?

The errors are of the form:

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project truedb: Compilation failure: Compilation failure:
[ERROR] /Users/joe/Documents/code/target/generated-sources/annotations/com/truespeed/truedb/account/AccountResourceRouter.java:[28,-1]
[ERROR] 1. ERROR in /Users/joe/Documents/code/truedb-truedb/target/generated-sources/annotations/com/truespeed/truedb/account/AccountResourceRouter.java (at line 28)
[ERROR] public class AccountResourceRouter extends RestxRouter {
[ERROR] ^^^^^^^^^^^^^^^^^^^^^
[ERROR] The type AccountResourceRouter is already defined

The class AccountResourceRouter is created during compilation of my AccountResource by an annotation processor in my code base (but not my code).

How do I teach groovy-eclipse-batch not to trip up on these classes? Is there a way?

To be clear, if I run with an empty target/ directory, it works as expected; it's only the second time around that it trips up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions