Re: Maven plugin for source generating

2021-03-09 Thread Mantas Gridinas
Sounds like you want annotation processing
https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/Processor.html

On Tue, Mar 9, 2021 at 4:12 PM Rimvydas Vaidelis
 wrote:
>
> Hello,
>
> I would like to write a maven plugin that transforms a java source code
> (adds specified annotations to methods). Lets say the source code contains
> java files A.java, B.java and C.java. Lets say only B.java must be
> transformed (transformer decides which java file should be transformed). I
> do not want to modify original sources so I will write the transformed
> class to a separate folder (target/myfolder).
> Compiling should compile A.java and C.java from src/main/java and B.java
> from target/myfolder. I can include the new source root in the plugin but
> the compiler plugin will find 2 classes with the same name and will fire an
> error.
> Is there a way to configure which source files should be excluded from the
> compilation? If so then maybe you can give some example of how to do that?
> Or maybe this path is too complicated?
>
> Thanks in advance for any help.
> --
> Rimvydas

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Maven plugin for source generating

2021-03-09 Thread Rimvydas Vaidelis
Hello,

I would like to write a maven plugin that transforms a java source code
(adds specified annotations to methods). Lets say the source code contains
java files A.java, B.java and C.java. Lets say only B.java must be
transformed (transformer decides which java file should be transformed). I
do not want to modify original sources so I will write the transformed
class to a separate folder (target/myfolder).
Compiling should compile A.java and C.java from src/main/java and B.java
from target/myfolder. I can include the new source root in the plugin but
the compiler plugin will find 2 classes with the same name and will fire an
error.
Is there a way to configure which source files should be excluded from the
compilation? If so then maybe you can give some example of how to do that?
Or maybe this path is too complicated?

Thanks in advance for any help.
--
Rimvydas