I'm looking into migrating from maven to gradle and in our current setup we have a master pom that defines all of our version dependencies.
the project name is master-pom and has snippets like this:
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${commons-beanutils-version}</version>
</dependency>
.... and later down in the file we define something along these lines:
<properties>
<commons-beanutils-version>1.9.1</commons-beanutils-version>
</properties>
Now, this is what I have so far:
plugins {
id "com.github.johnrengelman.shadow" version "1.2.4"
id "nebula.dependency-recommender" version "3.7.0"
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'nebula.dependency-recommender'
apply plugin: "com.github.johnrengelman.shadow"
version = '1.0.0-SNAPSHOT'
sourceCompatibility = '1.8'
description = """best-service-ever"""
repositories {
mavenLocal()
maven { url 'https://repo.server.com/nexus/content/groups/public'
credentials {
username 'username'
password nexusPassword
}
}
mavenCentral()
jcenter()
}
dependencyRecommendations {
mavenBom module: 'biz.company.name:master-pom:1.0.0-SNAPSHOT'
}
dependencies {
... some dependencies
compile 'biz.company.name:db-schema'
}
At this point it'll pick up the version named ${db-version} and use the correctly defined one from the build-maven. The problem is, I need to override that version with a specific version.
I tried putting the value in gradle.properties, but there's an issue with that.
db-version is unsupported by gradle, since it interprets - as arithmetic operation. I instead tried defining the value as
db_version=0.0.1700
which seems to work, but how do I set it so it overrides the $db-version value. I would like to avoid having to explicitly set the version: in every artifact.
My ideal scenario would either allow me to simply override the properties that come from the bom file.
Has anyone run into this issue before? Or have a work around?