Uzywam:
- Gradle do budowania projektu
- Javy 9
Poniewaz chcialbym użyć narzędzia QueryDSL postanowiłem wygenerowac klasy QueryDSL za pomocą narzędzia: https://github.com/ewerk/gradle-plugins/tree/master/querydsl-plugin
Klasy generuja sie i nawet wyglada to calkiem ok. Problem w tym, ze jak buduje projekt z poziomu konsoli to wszystko dziala ok, ale z poziomu Idei dostaje cala mase bledow typu:
-
"Package 'javax.annotation' is declared in module 'java.xml.ws.annotation' which is not in the module graph" - ten blad wystepuje w klasach oznaczonych adnotacja @Generated.
-
"package com.querydsl.core.types does not exist"
-
"Cannot resolve symbol 'BooleanPath'", "Cannot resolve symbol 'StringPath'" itd. Klasy BooleanPath oraz "StringPath" to oczywiscie klasy biblioteki QueryDSL, ktore nie wiadomo dlaczego nie sa widziane przez Idee. Moj plik build.gradle wyglada nastepujaco:
plugins {
id 'war'
id 'com.ewerk.gradle.plugins.querydsl' version '1.0.9'
id 'idea'
}
repositories {
jcenter()
}
querydsl {
jpa = true
library = 'com.querydsl:querydsl-apt:4.2.1'
}
apply plugin: 'idea'
sourceSets {
querydsl {
java {
srcDirs = [
'src/querydsl/java'
]
}
}
}
idea{
module {
sourceDirs += file('src/querydsl/java')
}
}
dependencies {
// Spring
compile 'org.springframework:spring-core:5.0.5.RELEASE'
compile 'org.springframework:spring-context:5.0.5.RELEASE'
compile 'org.springframework:spring-context-support:5.0.5.RELEASE'
compile 'org.springframework:spring-aspects:5.0.5.RELEASE'
compile 'org.springframework:spring-aop:5.0.5.RELEASE'
compile 'org.springframework:spring-webmvc:5.0.5.RELEASE'
compile 'org.springframework.data:spring-data-commons:2.0.6.RELEASE'
compile 'org.springframework.data:spring-data-jpa:2.0.6.RELEASE'
compile 'org.springframework.security:spring-security-web:5.0.5.RELEASE'
compile 'org.springframework.security:spring-security-config:5.0.5.RELEASE'
// Hibernate
compile 'org.hibernate:hibernate-entitymanager:5.2.17.Final'
compile 'org.hibernate.common:hibernate-commons-annotations:5.0.3.Final'
compile 'org.hibernate.validator:hibernate-validator:6.0.9.Final'
compile 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final'
// QueryDSL
compile 'com.querydsl:querydsl-apt:4.2.1'
compile 'com.querydsl:querydsl-core:4.2.1'
compile 'com.querydsl:querydsl-jpa:4.2.1'
compile 'com.querydsl:querydsl-sql:4.2.1'
compile 'com.querydsl:querydsl-sql-spring:4.2.1'
compile sourceSets.querydsl.output
// PostgreSQL
compile 'org.postgresql:postgresql:42.2.2'
// Joda Time
compile group: 'joda-time', name: 'joda-time', version: '2.10'
// Apache Commons
compile 'org.apache.commons:commons-lang3:3.7'
compile 'org.apache.commons:commons-text:1.4'
compile 'commons-io:commons-io:2.6'
// Google Guava
compile 'com.google.guava:guava:25.0-jre'
// Jackson
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.5'
// Java
compile 'javax.el:javax.el-api:3.0.0'
compile 'javax.xml:jaxb-api:2.1'
compile 'javax.xml:jaxb-impl:2.1'
compile 'javax.cache:cache-api:1.1.0'
compile 'org.glassfish:javax.el:3.0.0'
compile 'javax.annotation:jsr250-api:1.0'
providedCompile 'javax.servlet:javax.servlet-api:4.0.1'
providedCompile 'javax.annotation:javax.annotation-api:1.3.2'
// Ehcache
compile 'org.ehcache:ehcache:3.5.2'
// Logging
compile 'ch.qos.logback:logback-core:1.2.3'
compile 'ch.qos.logback:logback-classic:1.2.3'
// Test
testCompile 'org.springframework:spring-test:5.0.5.RELEASE'
testCompile 'org.springframework.security:spring-security-test:5.0.5.RELEASE'
testCompile 'org.testng:testng:6.14.3'
testCompile 'org.mockito:mockito-all:1.10.19'
testCompile 'org.hamcrest:hamcrest-all:1.3'
}
test {
useTestNG()
}
//================================================================================
// PROFILES
//================================================================================
if (project.hasProperty("production")) {
sourceSets.main.resources.srcDirs = [
'src/main/resources/commons',
'src/main/resources/production',
]
sourceSets.test.resources.srcDirs = [
'src/test/resources/commons',
'src/test/resources/production',
]
} else {
sourceSets.main.resources.srcDirs = [
'src/main/resources/commons',
'src/main/resources/development',
]
sourceSets.test.resources.srcDirs = [
'src/test/resources/commons',
'src/test/resources/development',
]
}
Jakies pomysly?