Comments (10)
There are several ways to achieve that in Gradle.
- You can define a resolution strategy to check and change the version of transitive dependencies manualy:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'io.zonky.test.postgres') {
details.useVersion '9.6.10'
}
}
}
- If you use Gradle 5+, Maven BOMs are supported out of the box, so you can import the bom:
dependencies {
implementation enforcedPlatform('io.zonky.test.postgres:embedded-postgres-binaries-bom:9.6.10')
}
- Or, you can use Spring's dependency management plugin that provides Maven-like dependency management to Gradle:
plugins {
id "io.spring.dependency-management" version "1.0.6.RELEASE"
}
dependencyManagement {
imports {
mavenBom 'io.zonky.test.postgres:embedded-postgres-binaries-bom:9.6.10'
}
}
from embedded-database-spring-test.
Thanks for the question I will update the documentation. Let me know if it helped.
from embedded-database-spring-test.
I didn't try the first approach and unfortunately I am using gradle 4.9.
However the third approach works :) 👍
Thanks for your help :)
from embedded-database-spring-test.
Glad to hear that, thanks for the info.
from embedded-database-spring-test.
Hi @tomix26, I tried solution 1 and 3 but I get both 9.6.9 and 10.7.0 bineries into my dependencies in gradle and if I debug DefaultPostgresBinaryResolver it retrieved the 10.7.0 binary.
Could you please help?
I am using Gradle 4.10.
from embedded-database-spring-test.
Hi @drej1, could you please provide your build.gradle
script?
from embedded-database-spring-test.
Hi @tomix26 ,
It's a multimodule project but I will try to add the relevant gradle files here:
root project: root_build.gradle
it includes: common.gradle
and there is a submodule which is dependency for other submodules: submodule_build.gradle
gradle_files.zip
from embedded-database-spring-test.
Hi @tomix26 any update for this? Thx
from embedded-database-spring-test.
I'm so sorry for the late response, this task is already closed, so I forgot about our previous conversation. I think the problem could be caused by the fact that you apply the plugin only to submodules. Try to move it directly into the root_build.gradle
script and don't use the apply false
syntax for this plugin.
Something like this:
buildscript {
ext {
// START for common.gradle
swaggerCodegenVersion = "2.2.3"
swaggerAnnotationsVersion = "1.5.21"
springfoxSwaggerVersion = "2.9.2"
mapstructMapperVersion = "1.3.0.Final"
redissonVersion = "3.10.7"
// END for common.gradle
}
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
maven { url "http://repo.spring.io/plugins-release" }
maven {
url "http://nexus.services.itc.st.sk:8081/repository/maven-central/"
credentials {
username "service-hal"
password "XXX"
}
}
}
dependencies {
// START for common.gradle
classpath("io.spring.gradle:propdeps-plugin:0.0.9.RELEASE") // provides additional optional and provided dependency configurations
classpath("io.swagger:swagger-codegen:${swaggerCodegenVersion}")
// END for common.gradle
}
}
plugins {
id "io.spring.dependency-management" version "1.0.6.RELEASE"
// spring boot
id "org.springframework.boot" version "2.1.5.RELEASE" apply false
// lombok
id "io.franzbecker.gradle-lombok" version "3.0.0" apply false
// for annotation processors | gradle 5 should have native support for annotation processors, so this plugin might be removed from the project after gradle upgrade
id "net.ltgt.apt" version "0.21" apply false
id "net.ltgt.apt-idea" version "0.21" apply false
// flyway gradle plugin
// please keep this version in sync with spring boot defined ${flyway.version}
// https://github.com/spring-projects/spring-boot/blob/v2.1.5.RELEASE/spring-boot-project/spring-boot-dependencies/pom.xml
id "org.flywaydb.flyway" version "5.2.4" apply false
// sonarqube
id "org.sonarqube" version "2.7.1" apply false
}
dependencyManagement {
imports {
mavenBom 'io.zonky.test.postgres:embedded-postgres-binaries-bom:9.6.10'
}
}
group "sk.telekom.oneapp.hal"
version "1.0-SNAPSHOT"
apply from:"./gradle-common/common.gradle"
from embedded-database-spring-test.
Hi @tomix26 , it didn't help, but I made some changes... I had to add
{code}
dependencyManagement {
imports {
mavenBom 'io.zonky.test.postgres:embedded-postgres-binaries-bom:9.6.10'
}
}
{code}
into the common.gradle into the subprojects {} closure... this way it was set in all subprojects using your library.
Thanks :)
from embedded-database-spring-test.
Related Issues (20)
- Updated Dependencies leads to different Integration test behaviour HOT 6
- Build with -parameters compiler arg HOT 1
- Spring Boot 3.1 Support HOT 8
- Upgrade to Embedded Postgres 2.0.5
- All data providers being required when only a specific one is specified HOT 5
- Zonky "initdb" file getting returning file not found HOT 4
- Multiple PostgreSQL clusters (instances) HOT 1
- Tests using @FlywayTest(locationsForMigrate) failing after changing spring and flyway versions HOT 3
- Setting PostgreSQL max_connections value in properties gives PSQLException HOT 2
- Custom docker image with test data: How to use as a template HOT 4
- [Q]: Any plans to update testcontainers? HOT 5
- Flyway migration in multitenant application HOT 1
- Transitive vulnerable dependency HOT 1
- Use Zonky provider with PostGIS HOT 3
- For Flyway 9.9+ JavaMigration beans are not applied HOT 4
- Upgrade to Embedded Postgres 2.0.7
- db rider with zonkyio embedded postgresql HOT 3
- data type (1111, 'jsonb') not recognized and will be ignored HOT 1
- DockerClientProviderException HOT 1
- Spring Boot 3.3 Support HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from embedded-database-spring-test.