我想在gradle中使用maven等效的&usqp=mq331AQCCAE=
:
properties
当我在<properties>
<spring-batch.version>4.0.0.M2</spring-batch.version>
</properties>
中添加ext['spring-batch.version'] = '4.0.0.M2'
时,导入无效。
build.gradle
我还尝试在buildscript {
ext {
springBootVersion = '1.5.4.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
ext['spring-batch.version'] = '4.0.0.M2'
dependencies {
compile('org.springframework.boot:spring-boot-starter-batch')
compile("org.hsqldb:hsqldb")
}
中添加spring-batch.version=4.0.0.M2
,但也无法使用。
答案 0 :(得分:4)
失败了,因为4.0.0.M2
isn't in Maven central。
要解决此问题,请添加Spring里程碑Maven存储库:
repositories {
mavenCentral()
maven {
url "http://repo.spring.io/libs-milestone"
}
}
答案 1 :(得分:-1)
首先我使用新的插件机制如下:
buildscript {
repositories { mavenCentral() }
}
plugins {
id 'java'
id 'application' // for docker needed the main class in jar manifest
id 'eclipse'
id 'idea'
id 'org.springframework.boot' version '1.5.4.RELEASE' // automagically includes io.spring.dependency-management
}
这应该自动为您提供所有org.springframework.boot
依赖项的正确版本,而不必明确指定它们(因此无需为spring-batch提供版本号。
如果您想要进一步定义project.ext属性,请执行以下操作:
ext {
group = 'minimal_cloud_stream_producer'
groupId = 'de.demo'
baseName = 'minimal_cloud_stream_producer'
port = 8080
}
也许您还必须添加dependencyManagement
部分,如此
dependencyManagement {
imports {
mavenBom 'org.springframework.boot:spring-boot-starter-parent:1.5.4.RELEASE'
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Dalston.SR1'
}
}