使用Gradle为Spring Data和MongoDB配置QueryDSL [英] Configuring QueryDSL for Spring Data and MongoDB with Gradle

查看:521
本文介绍了使用Gradle为Spring Data和MongoDB配置QueryDSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我没有正确配置存储库,但是以下build.gradle也存在其他问题:

I guess I haven't configured the repositories properly, but there are other problems too with the following build.gradle:

buildscript {
    repositories {

        mavenCentral()
        maven { url "http://repo.spring.io/libs-snapshot" }
        jcenter()

    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.RELEASE")
        classpath "gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.7"
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'com.ewerk.gradle.plugins.querydsl'

jar {
    baseName = 'aydin'
    version =  '0.1.0'
}

repositories {
    jcenter()
    mavenCentral()
    maven { url "http://repo.spring.io/libs-snapshot" }

}

querydsl {
    springDataMongo = true
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-data-mongodb")

    compile group: "de.flapdoodle.embed", name: "de.flapdoodle.embed.mongo", version: "1.50.3"

    compile "com.mysema.querydsl:querydsl-jpa:3.6.3"
    compile "com.mysema.querydsl:querydsl-apt:3.6.3:jpa" // Magic happens here
    compile "com.querydsl.apt:querydsl-mongodb:4.0.9"

    testCompile("org.springframework.boot:spring-boot-starter-test")
    testCompile("junit:junit")
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.14'
}

这给了我:

Which gives me:


无法解析配置':classpath'的所有依赖关系。
无法解析gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.7。
要求为:
...
无法解析gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.7。
无法获取资源' http://repo.spring.io/libs-snapshot/gradle/plugin/com/ewerk/gradle/plugins/querydsl-plugin/1.0.7/querydsl-插件-1.0.7.pom
无法HEAD' http://repo.spring.io/libs-snapshot/gradle/plugin/com/ewerk/gradle/plugins/querydsl-plugin/1.0.7/querydsl-plugin -1.0.7.pom 。从服务器收到的状态码502:错误的网关

Could not resolve all dependencies for configuration ':classpath'. Could not resolve gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.7. Required by: ... Could not resolve gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.7. Could not get resource 'http://repo.spring.io/libs-snapshot/gradle/plugin/com/ewerk/gradle/plugins/querydsl-plugin/1.0.7/querydsl-plugin-1.0.7.pom'. Could not HEAD 'http://repo.spring.io/libs-snapshot/gradle/plugin/com/ewerk/gradle/plugins/querydsl-plugin/1.0.7/querydsl-plugin-1.0.7.pom'. Received status code 502 from server: Bad Gateway


推荐答案

可能需要包含回购querydsl插件?

Possibly you need to include the repo having the querydsl plugin?

    maven { url "https://plugins.gradle.org/m2/" }

这篇关于使用Gradle为Spring Data和MongoDB配置QueryDSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆