How to specify redis client dependency for logback-redis-appender - gradle

How to specify latest redis client dependency for logback-redis-appender in gradle
https://mvnrepository.com/artifact/com.cwbase/logback-redis-appender/1.1.5
I want to use 2.9.0 dependency of https://mvnrepository.com/artifact/redis.clients/jedis instead of 2.5.2 being used right now.

Add to build.gradle:
compile group: 'redis.clients', name: 'jedis', version: '2.9.0'
or
dependencies {
compile "redis.clients:jedis:2.9.0"
}

Related

HBase 2.1.0 - CDH6.3.3 - Gradle Import fails

I tried import hbase 2.1.0 of cloudera 6.3.3 at my gradle file like this:
compile ("org.apache.hbase:hbase-client:2.1.0-cdh6.3.3"){
exclude group: 'org.slf4j'
exclude group: 'org.jruby'
exclude group: 'jruby-complete'
exclude group: 'org.codehaus.jackson'
exclude group: 'org.codehaus.jettison'
}
When I refresh the gradle , it shows below error:
Could not resolve org.apache.hbase:hbase-client:2.1.0-cdh6.3.3.
I tried refreshing gradle dependencies , but no luck
Any help appreciated! Thanks in Advance!
When you are in doubt about dependencies like this, use a repository aggregator like mvnrepository and search for the module. You can find version 2.1.0-cdh6.3.3 of HBase Client here:
As you can see from the description, the artifact is located in the Cloudera Maven repository, so you will need to configure that in Gradle:
repositories {
maven {
url "https://repository.cloudera.com/artifactory/cloudera-repos/"
}
}
Also, don't use the compile configuration as it is deprecated. Use implementation or similar instead.

Forcing flink to use different kafka-clients jar

i am using Flink Connector Kafka 1.8.0. (depends on kafka-clients 2.0.1)
https://mvnrepository.com/artifact/org.apache.flink/flink-connector-kafka_2.12/1.8.0
using gradle:
// https://mvnrepository.com/artifact/org.apache.flink/flink-connector-kafka
compile group: 'org.apache.flink', name: 'flink-connector-kafka_2.12', version: '1.8.0'
i wonder if i can force it to use kafka-clients 2.4.0
i wodering if flink supports it, and even so, how it can be configured through
gradle?
can you assist?
Yes, you can configure that by simply explicitly including the dependency with the version that you want
compile group: 'org.apache.flink', name: 'flink-connector-kafka_2.12', version: '1.8.0'
compile group: 'org.apache.kafka', name: 'kafka_2.13', version: '2.4.0'
You can test which version has been chosen with
gradle dependencies

How to setup Spek Framework

I've checked the docs:
https://spekframework.org/migration/#maven-coordinates
I wanted to try out version 2.x.x, so I added in build.gradle:
testImplementation ("org.spekframework.spek2:spek-dsl-jvm:2.0.0")
testRuntimeOnly ('org.spekframework.spek2:spek-runner-junit5')
But Gradle is unable to find that 2.x.x library in Maven Central:
https://search.maven.org/search?q=spek-dsl-jvm
What should I do? Is there a special repo?
try to configure your repositories with:
maven { url 'https://oss.jfrog.org/artifactory/libs-snapshot'}
Your dependency should be as follows:
dependency "org.spekframework.spek2:spek-dsl-jvm:$spekVersion"
where spekVersion = "2.0.0-SNAPSHOT"
You should add the following maven repo to your build file:
repositories {
jcenter()
}
Then for the dependencies:
testCompile group: 'org.spekframework.spek2', name: 'spek-dsl-jvm', version: '2.0.0-rc.1'
testCompile group: 'org.spekframework.spek2', name: 'spek-runner-junit5', version: '2.0.0-rc.1'
You could also checkout https://github.com/spekframework/spek-multiplatform-example for more info.

Opentok SDK not Spring-boot compliant due new Jackson 2.9 release

My Spring-boot application started failing once Jackson 2.9 was released on 2nd of March. I am using Gradle for building and Spring boot version 1.5.2 which depends on Jackson-core 2.8.7.
In addition I need Opentok SDK which I have added as dependency:
compile group: 'com.tokbox', name: 'opentok-server-sdk', version: '2.3.2'
I suppose the reason is the Opentok SDK dependency definition which allows downloading newer JAR for Jackson which then creates a mismatch of libraries as several versions of Jackson JARs are downloaded:
https://github.com/opentok/Opentok-Java-SDK/blob/master/build.gradle
dependencies {
...
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '[2.3.1,2.99999)'
How to sort this out?
I am not an expert of Gradle but could I somehow force Opentok to use 2.8.7 version?
I cannot deliver at the moment at all so please help.
I think this should be useful: https://docs.gradle.org/current/userguide/dependency_management.html#sub:version_conflicts
As well as the guide here: https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.dsl.DependencyHandler.html#N1627D
Approaches might differ, but you can set Gradle to force = true for Spring's jackson-databind dependency.
This is how I sorted it out
compile ('com.tokbox:opentok-server-sdk:2.3.2')
{
// Jackson 2.9 is not compatible with Spring boot 1.4.4 - 1.5.2
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'
}

Gradle dependency management using pom.xml

In build.gradle we specify the dependencies as
compile group: 'org.apache.pig', name: 'pigunit', version: '0.11.0-cdh4.5.0', transitive: true
Running gradle cleanEclipse eclipse sets up the projects(adds the jar to classpath)
However there are only maven dependencies available for some APIs
(I am trying to run jersey 2.x examples bundle from https://jersey.java.net/download.html and it provides only pom.xml)
EDIT:
I know i can specify
compile group: 'groupId', name: 'artifactId', version: 'version' gradle but doing it manually for all dependencies or writing a program to do so should not be natural gradle way.
Gradle provides a maven plugin http://gradle.org/docs/current/userguide/maven_plugin.html.I haven't tried it out but it should be able to do it
Gradle supports Maven dependencies. Just specify the dependencies in the same way as your example:
compile group: 'groupId', name: 'artifactId', version: 'version'
To lookup the the artifact coordinates, you can use sites like http://search.maven.org
The only thing you have to make sure is to include either your internal Maven repository (if you are in a company which has one) or Maven Central:
repositories {
mavenCentral()
}
or
repositories {
maven {
url "http://repo.mycompany.com/maven2"
}
}

Resources