简体   繁体   中英

How to ignore the Java Source directory during Maven Compilation?

I am trying to use the Lombok Maven Plugin to ensure the correct creation of Javadocs when using Lombok .

Lombok Maven introduces a new code generation goal, just prior to compilation. In my configuration, my sourceDirectory (Java with Lombok annotations, src/main/java ) is processed to create Java (without Lombok annotations) in target/generated-sources/delombok .

However, every file in sourceDirectory now has a corresponding (identically named) file in target/generated-sources/delombok , resulting in compilation failures due to duplicate classes.

How can I tell the Java compiler to ignore the sources in sourceDirectory ?

Note that the default Lombok Maven configuration would have the developer put Java (with Lombok annotations) in the src/main/lombok folder instead of src/main/java . However, I do not wish to do this because it confuses IDEs and my code compiles just fine (if I remove the Maven plugin).

Also note that simply redefining sourceDirectory will also upset IDEs (they no longer know where to find the Java source code.).

I am trying to use the Lombok Maven Plugin to ensure the correct creation of Javadocs when using Lombok .

Lombok Maven introduces a new code generation goal, just prior to compilation. In my configuration, my sourceDirectory (Java with Lombok annotations, src/main/java ) is processed to create Java (without Lombok annotations) in target/generated-sources/delombok .

However, every file in sourceDirectory now has a corresponding (identically named) file in target/generated-sources/delombok , resulting in compilation failures due to duplicate classes.

How can I tell the Java compiler to ignore the sources in sourceDirectory ?

Note that the default Lombok Maven configuration would have the developer put Java (with Lombok annotations) in the src/main/lombok folder instead of src/main/java . However, I do not wish to do this because it confuses IDEs and my code compiles just fine (if I remove the Maven plugin).

Also note that simply redefining sourceDirectory will also upset IDEs (they no longer know where to find the Java source code!).

I am trying to use the Lombok Maven Plugin to ensure the correct creation of Javadocs when using Lombok .

Lombok Maven introduces a new code generation goal, just prior to compilation. In my configuration, my sourceDirectory (Java with Lombok annotations, src/main/java ) is processed to create Java (without Lombok annotations) in target/generated-sources/delombok .

However, every file in sourceDirectory now has a corresponding (identically named) file in target/generated-sources/delombok , resulting in compilation failures due to duplicate classes.

How can I tell the Java compiler to ignore the sources in sourceDirectory ?

Note that the default Lombok Maven configuration would have the developer put Java (with Lombok annotations) in the src/main/lombok folder instead of src/main/java . However, I do not wish to do this because it confuses IDEs and my code compiles just fine (if I remove the Maven plugin).

Also note that simply redefining sourceDirectory will also upset IDEs (they no longer know where to find the Java source code!).

I am trying to use the Lombok Maven Plugin to ensure the correct creation of Javadocs when using Lombok .

Lombok Maven introduces a new code generation goal, just prior to compilation. In my configuration, my sourceDirectory (Java with Lombok annotations, src/main/java ) is processed to create Java (without Lombok annotations) in target/generated-sources/delombok .

However, every file in sourceDirectory now has a corresponding (identically named) file in target/generated-sources/delombok , resulting in compilation failures due to duplicate classes.

How can I tell the Java compiler to ignore the sources in sourceDirectory ?

Note that the default Lombok Maven configuration would have the developer put Java (with Lombok annotations) in the src/main/lombok folder instead of src/main/java . However, I do not wish to do this because it confuses IDEs and my code compiles just fine (if I remove the Maven plugin).

Also note that simply redefining sourceDirectory will also upset IDEs (they no longer know where to find the Java source code!).

I am trying to use the Lombok Maven Plugin to ensure the correct creation of Javadocs when using Lombok .

Lombok Maven introduces a new code generation goal, just prior to compilation. In my configuration, my sourceDirectory (Java with Lombok annotations, src/main/java ) is processed to create Java (without Lombok annotations) in target/generated-sources/delombok .

However, every file in sourceDirectory now has a corresponding (identically named) file in target/generated-sources/delombok , resulting in compilation failures due to duplicate classes.

How can I tell the Java compiler to ignore the sources in sourceDirectory ?

Note that the default Lombok Maven configuration would have the developer put Java (with Lombok annotations) in the src/main/lombok folder instead of src/main/java . However, I do not wish to do this because it confuses IDEs and my code compiles just fine (if I remove the Maven plugin).

Also note that simply redefining sourceDirectory will also upset IDEs (they no longer know where to find the Java source code!).

I am trying to use the Lombok Maven Plugin to ensure the correct creation of Javadocs when using Lombok .

Lombok Maven introduces a new code generation goal, just prior to compilation. In my configuration, my sourceDirectory (Java with Lombok annotations, src/main/java ) is processed to create Java (without Lombok annotations) in target/generated-sources/delombok .

However, every file in sourceDirectory now has a corresponding (identically named) file in target/generated-sources/delombok , resulting in compilation failures due to duplicate classes.

How can I tell the Java compiler to ignore the sources in sourceDirectory ?

Note that the default Lombok Maven configuration would have the developer put Java (with Lombok annotations) in the src/main/lombok folder instead of src/main/java . However, I do not wish to do this because it confuses IDEs and my code compiles just fine (if I remove the Maven plugin).

Also note that simply redefining sourceDirectory will also upset IDEs (they no longer know where to find the Java source code!).

Hit similar issue in Intellj, this worked for me:

IntellIJ IDEA -> Preferences -> Build, Execution, Deployment -> Compiler -> User-local build process VM options (overrides Shared options): -Djps.track.ap.dependencies=false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM