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

Unable to use QueryDSL with my spring boot 3 project #3693

Open
Gaga-for-coding opened this issue Feb 25, 2024 · 3 comments
Open

Unable to use QueryDSL with my spring boot 3 project #3693

Gaga-for-coding opened this issue Feb 25, 2024 · 3 comments
Labels

Comments

@Gaga-for-coding
Copy link

[## Observed vs. expected behavior
My IDE keeps giving this error java: Attempt to recreate a file for type com.guissisoftware.starter.model.QCourse
whenever I run mvn clean install

Steps to reproduce


4.0.0

org.springframework.boot
spring-boot-starter-parent
3.1.5


com.guissisoftware
starter
0.0.1-SNAPSHOT
starter
Journey to learning Spring boot with Musib

<java.version>17</java.version>
<querydsl.version>5.1.0</querydsl.version>



org.springframework.boot
spring-boot-starter-web


org.springframework.boot
spring-boot-starter-logging


	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-data-jpa</artifactId>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
	</dependency>

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

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-jooq</artifactId>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-log4j2</artifactId>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-validation</artifactId>
	</dependency>
</dependencies>

<build>
	<plugins>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
		</plugin>
		<!-- Plugin added for querydsl support -->
		<plugin>
			<groupId>com.mysema.maven</groupId>
			<artifactId>apt-maven-plugin</artifactId>
			<version>1.1.3</version>
			<executions>
				<execution>
					<goals>
						<goal>process</goal>
					</goals>
					<configuration>
						<outputDirectory>target/generated-sources/java</outputDirectory>
						<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
					</configuration>
				</execution>
			</executions>
			<dependencies>
				<dependency>
					<groupId>com.querydsl</groupId>
					<artifactId>querydsl-apt</artifactId>
					<version>${querydsl.version}</version>
				</dependency>
			</dependencies>
		</plugin>
	</plugins>
</build>

Environment

Windows 10, Intellij Idea

Querydsl version: 5.1.0

Querydsl module:

Database:
Spring boot
JDK:
Java 17

Additional details

](java: Attempt to recreate a file for type com.guissisoftware.starter.model.QCourse)

@billschen
Copy link

billschen commented Feb 28, 2024

I use with Gradle 8.5 and jdk 21.0.1 and spring boot 3.x,no problem. the error key word is "recreate". this is a annotations process error happen when dupplicated file name recreate. I guess your setting may have some problem.

@ivan-slavchev
Copy link

ivan-slavchev commented Mar 12, 2024

@Gaga-for-coding you can try to remove the querydsl-apt dependencies from </dependencies> and leave it only inside the <plugin> as dependency. Also might be necessary to add the jakarta classifier there. This is what worked for me at least.

@velo
Copy link
Contributor

velo commented Apr 6, 2024

Try my fork
https://github.com/OpenFeign/querydsl

Its active, and people PRs are not ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants