Reputation: 4902
I would like the maven equivalent of properties
in gradle:
<properties>
<spring-batch.version>4.0.0.M2</spring-batch.version>
</properties>
When I added ext['spring-batch.version'] = '4.0.0.M2'
in build.gradle
, imports are not working.
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")
}
I also tried to add spring-batch.version=4.0.0.M2
in gradle.properties
, but not working also.
Upvotes: 2
Views: 2242
Reputation: 1563
first I'd use the new plugin mechanis like so:
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
}
this should automagically give you the correct version of all org.springframework.boot
dependencies, without having to specify them explicitly (so no need to give a version number for spring-batch.
if you'd like to define further project.ext properties, do so like:
ext {
group = 'minimal_cloud_stream_producer'
groupId = 'de.demo'
baseName = 'minimal_cloud_stream_producer'
port = 8080
}
maybe you have to add a dependencyManagement
section too, like so
dependencyManagement {
imports {
mavenBom 'org.springframework.boot:spring-boot-starter-parent:1.5.4.RELEASE'
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Dalston.SR1'
}
}
Upvotes: -1
Reputation: 59699
It's failing because 4.0.0.M2
isn't in Maven central.
To fix it, add the Spring milestone Maven repository:
repositories {
mavenCentral()
maven {
url "http://repo.spring.io/libs-milestone"
}
}
Upvotes: 4