Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on javax.inject from querydsl. #1992

Merged

Conversation

mikereiche
Copy link
Collaborator

To use querydsl, the spring application will need to add a dependency

<dependency>
    <groupId>com.querydsl</groupId>
    <artifactId>querydsl-apt</artifactId>
    <version>${querydsl}</version>
    <classifier>jakarta</classifier>
    <scope>provided</scope>
</dependency>

And explicitly specify CouchbasseAnnotationProcessor

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <executions>
        <execution>
            <id>annotation-processing</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>compile</goal>
            </goals>
            <configuration>
                <proc>only</proc>
                <annotationProcessors>
                    <annotationProcessor>org.springframework.data.couchbase.repository.support.CouchbaseAnnotationProcessor</annotationProcessor>
                </annotationProcessors>
                <generatedTestSourcesDirectory>target/generated-test-sources</generatedTestSourcesDirectory>
                <compilerArgs>
                    <arg>-Aquerydsl.logInfo=true</arg>
                </compilerArgs>
            </configuration>
        </execution>
    </executions>
</plugin>

Closes #1989.

To use querydsl, the spring application will need to add a dependency

    <dependency>
        <groupId>com.querydsl</groupId>
        <artifactId>querydsl-apt</artifactId>
        <version>${querydsl}</version>
        <classifier>jakarta</classifier>
        <scope>provided</scope>
    </dependency>

And explicitly specify CouchbasseAnnotationProcessor

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
            <execution>
                <id>annotation-processing</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>compile</goal>
                </goals>
                <configuration>
                    <proc>only</proc>
                    <annotationProcessors>
                        <annotationProcessor>org.springframework.data.couchbase.repository.support.CouchbaseAnnotationProcessor</annotationProcessor>
                    </annotationProcessors>
                    <generatedTestSourcesDirectory>target/generated-test-sources</generatedTestSourcesDirectory>
                    <compilerArgs>
                        <arg>-Aquerydsl.logInfo=true</arg>
                    </compilerArgs>
                </configuration>
            </execution>
        </executions>
    </plugin>

Closes #1989.
@@ -79,7 +79,7 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
return ALLOW_OTHER_PROCESSORS_TO_CLAIM_ANNOTATIONS;
}

Configuration conf = createConfiguration(roundEnv);
Configuration conf = createConfiguration(roundEnv);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting.

Copy link
Member

@mp911de mp911de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. It makes sense to document how to use Couchbase's Annotation Processor. I plan to come up with some docs for MongoDB so you can take that as inspiration for the Couchbase docs.

@mp911de
Copy link
Member

mp911de commented Oct 17, 2024

Here's the PR for MongoDB's annotation processor usage. spring-projects/spring-data-mongodb#4814

I found that it isn't necessary to use the jakarta classifier during annotation processing. Maybe this is a simplification in your case as well.

@mikereiche mikereiche merged commit bc0c757 into main Oct 17, 2024
3 checks passed
mikereiche added a commit that referenced this pull request Oct 17, 2024
To use querydsl, the spring application will need to add a dependency

    <dependency>
        <groupId>com.querydsl</groupId>
        <artifactId>querydsl-apt</artifactId>
        <version>${querydsl}</version>
        <classifier>jakarta</classifier>
        <scope>provided</scope>
    </dependency>

And explicitly specify CouchbasseAnnotationProcessor

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
            <execution>
                <id>annotation-processing</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>compile</goal>
                </goals>
                <configuration>
                    <proc>only</proc>
                    <annotationProcessors>
                        <annotationProcessor>org.springframework.data.couchbase.repository.support.CouchbaseAnnotationProcessor</annotationProcessor>
                    </annotationProcessors>
                    <generatedTestSourcesDirectory>target/generated-test-sources</generatedTestSourcesDirectory>
                    <compilerArgs>
                        <arg>-Aquerydsl.logInfo=true</arg>
                    </compilerArgs>
                </configuration>
            </execution>
        </executions>
    </plugin>

Closes #1989.
mikereiche added a commit that referenced this pull request Oct 17, 2024
To use querydsl, the spring application will need to add a dependency

    <dependency>
        <groupId>com.querydsl</groupId>
        <artifactId>querydsl-apt</artifactId>
        <version>${querydsl}</version>
        <classifier>jakarta</classifier>
        <scope>provided</scope>
    </dependency>

And explicitly specify CouchbasseAnnotationProcessor

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
            <execution>
                <id>annotation-processing</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>compile</goal>
                </goals>
                <configuration>
                    <proc>only</proc>
                    <annotationProcessors>
                        <annotationProcessor>org.springframework.data.couchbase.repository.support.CouchbaseAnnotationProcessor</annotationProcessor>
                    </annotationProcessors>
                    <generatedTestSourcesDirectory>target/generated-test-sources</generatedTestSourcesDirectory>
                    <compilerArgs>
                        <arg>-Aquerydsl.logInfo=true</arg>
                    </compilerArgs>
                </configuration>
            </execution>
        </executions>
    </plugin>

Closes #1989.
@mikereiche mikereiche deleted the sdc_1989_remove_couchbaseannotationprocessor_from_services branch October 18, 2024 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants