Best way to implement pugin for Java source transformation files with rule based model


my goal is to write a plugin that transforms a DSL into Java source code, which is then compiled with the standard Java source sets using the “compile” task.

The solutions I tried are:

  1. Creating a LanguageTransform, but there is no TransformationFileType for JavaSourceCode, only for JvmByteCode. However, I do not want to duplicate the compile functionality in my plugin.

  2. Manually add the directories with my generated code to the Java source sets, however, the component model is already frozen, because I need to access the components created by my plugin.

  3. Currently I’m thinking about creating a “dummy” binary component, but this just doesn’t feel right.

Any help pointing me towards best practices would be greatly appreciated!


I’m still new to this, but I’m doing something similar in my plugin.

My approach is to create a separate source set for the output files, and to use as the input source set a new custom class. In your case, the output source set would be an

Hope this helps :slight_smile: