inferred/FreeBuilder

IntelliJ, Auto-Discover Processors from Maven

eischet opened this issue · 1 comments

Hello FreeBuilder team,

I've started using FreeBuilder and, more recently, the Google Auto Service Processor, in a Maven build.
At first, including the Auto Processor disabled FreeBuilder. I think it's because the Google plugin is explicitly added to the POM, disabling discovery of other processors.

Then, I came up with this:

<plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <annotationProcessors>
                <annotationProcessor>org.inferred.freebuilder.processor.Processor</annotationProcessor>
                <annotationProcessor>com.google.auto.service.processor.AutoServiceProcessor</annotationProcessor>
            </annotationProcessors>
            <annotationProcessorPaths>
                <path>
                    <groupId>org.inferred</groupId>
                    <artifactId>freebuilder</artifactId>
                    <version>2.6.2</version>
                </path>
                <path>
                    <groupId>com.google.auto.service</groupId>
                    <artifactId>auto-service</artifactId>
                    <version>${auto-service.version}</version>
                </path>
            </annotationProcessorPaths>
        </configuration>
</plugin>

This fixed my build. It also turns out that IntelliJ picks this up automatically and put it into the settings.
This way, I do not have to configure the settings manually in IntelliJ.
I'm using the latest version 2020.2.3.

I never configured the annotation processors manually, but there they are:

image

I can send a pull request for the readme if you think this is a valid approach, but I thought I'd better submit an issue first to discuss.

Regards,
Stefan

Hi Stefan,

If you would like to add this extra configuration as a subsection of https://github.com/inferred/FreeBuilder/#maven, with an explanation of when it might be needed, that would be very much appreciated!

Cheers,
Alice