Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialThossaporn Itngam
2,348 Pointshow to change maven to gradle of querydsl
i am following : https://github.com/querydsl/querydsl/tree/master/querydsl-jpa
normally, i use gradle for load dependency but it's not enough. now i suspect about how to use plugin of gradle.
how can i change maven script below to gradle and advice me more detail about this.
thanks.
<project>
<build>
<plugins>
...
<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>
</project>
2 Answers
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsWhat you are looking for is Gradle Plugin for QueryDsl.
See GitHub repo here
Important thing is to incorporate your generated classes so that Intellijdea can for example help you build QueryDsl queries.
This here is one of the examples...
I've done it once, but don't have example at hand. When I have time I will try to compile info and post here...
One thing I remember that was Super Important.
Do NOT check 'Create Separate module per source set'. This way you screw things up. For more on this read here
Thossaporn Itngam
2,348 Pointsyes, but i am trying to follow this : http://www.querydsl.com/static/querydsl/latest/reference/html/ch02.html#jpa_integration
and i dont know how to migrate maven to gradle
<project>
<build>
<plugins>
...
<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>
</plugin>
...
</plugins>
</build>
</project>
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsPlease forget about converting maven to Gradle. You cannot simply convert.
Maven use its own plugin in own way, Gradle uses its own plugin in its own way.
Please follow the links in the answer.
Your Gradle as you can see here
Please follow that link ...
So in the GitHub repo you see that in the end your build.gradle
will looks somewhat like that (The example below is for MongoDb, taken from GitHub repo of Gradle Plugin)
plugins {
id "com.ewerk.gradle.plugins.querydsl" version "1.0.8"
}
repositories {
mavenCentral()
}
dependencies {
[…]
// make MongoDB annotation processor available at classpath
compile "org.springframework.data:spring-data-mongodb:1.9.1.RELEASE"
// use Querydsl against MongoDB
compile "com.querydsl.apt:querydsl-mongodb:4.1.3"
[…]
}
querydsl {
springDataMongo = true
}