spring-projects / spring-data-couchbase

Provides support to increase developer productivity in Java when using Couchbase. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
https://spring.io/projects/spring-data-couchbase
Apache License 2.0
274 stars 190 forks source link

Better Annotation Processing for QueryDSL #1870

Closed babltiga closed 9 months ago

babltiga commented 10 months ago

Currently, the annotation processing for QueryDSL is done via CouchbaseAnnotationProcessor which is not "auto-discovery" enabled, which makes it hard to use in gradle and maven projects, as it requires some advanced configuration. I propose we add the CouchbaseAnnotationProcessor to the META-INF/services/javax.annotation.processing.Processor file so it can be auto-discovered if the jar is added as an annotation processor on the project.

So project configuration can be as simple as

For Maven projects

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>[compiler-plugin-version]</version>
            <configuration>
                <annotationProcessorPaths>
                    <!-- path to the annotation processor -->
                    <path>
                        <groupId>com.querydsl</groupId>
                        <artifactId>querydsl-apt</artifactId>
                        <version>[version]</version>
                    </path>
                    <path>
                        <groupId>org.springframework.data</groupId>
                        <artifactId>spring-data-couchbase</artifactId>
                        <version>[version]</version>
                    </path>
                </annotationProcessorPaths>
            </configuration>
        </plugin>
    </plugins>
</build>

Gradle projects

annotationProcessor 'com.querydsl:querydsl-apt:${querydslVersion}'
annotationProcessor 'org.springframework.data:spring-data-couchbase:${springDataCouchbaseVersion}'

Will push a PR with a proposal.

mikereiche commented 10 months ago

I'm on vacation. I'll look at this next week