HBase 2.1.0 - CDH6.3.3 - Gradle Import fails - gradle

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.

Related

Maven Project in IntelliJ, include Gradle Plugin

I'm new to IntelliJ and Gradle
I've got a Maven Project with a lot of dependencies which works on it's own.
Now I should use the libraries from that Project and create a Plugin for IntelliJ in Gradle.
I tried various ways to add the dependencies in the IntelliJ Module Settings, which allowed me to use the needed classes to write my code and build it. However, when I tried to start the plugin, it couldn't find the classes anymore.
I think I need to specify these in the build.gradle but I don't understand exactly how, as all the ways I tried didn't worked.
build.gradle:
plugins {
id 'java'
id 'org.jetbrains.intellij' version '0.6.5'
}
group 'com.ast.devmate.intellij'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
**compile 'com.ast.devmate.intellij:root:1.0.0-SNAPSHOT'**
}
// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version '2019.1'
}
patchPluginXml {
changeNotes """
Add change notes here.<br>
<em>most HTML tags may be used</em>"""
}
gets me this:
Could not find com.ast.devmate.intellij:root:1.0.0-SNAPSHOT.
without the line marked with ** I got a lot of
error: package foo does not exist
import foo;
It looks like you're trying to access a custom library using Gradle. You will probably need to use a file dependency: How to add local .jar file dependency to build.gradle file?

Gradle does not download complete dependencies

Im trying to download and build spring-data-hadoop 2.4.0.RELEASE using the following decleration in my dependencies.gradle:
dependencies {
...
// compile('org.springframework.data:spring-data_hadoop:2.4.0.RELEASE')
compile group: 'org.springframework.data', name: 'spring-data-hadoop', version: '2.4.0.RELEASE'
...
}
Refreshing gradle now results in downloading the newly added dependency BUT the data is not consistend. I got the following external dependencies after the download:
I thought everything is fine now... but I am wrong. Lets open up one of those and look depper into the packages:
If you compare the content of org.springframework.data.hadoop.config with the official API you will notice, that in this package, there should be much more content. The annotations package for example.
How can it be that gradle is not downloading the complete source?
There is a separate spring-data-hadoop-config with the description "Spring for Apache Hadoop Annotation Configuration", so that's probably where annotations would be.
You are pulling the main jar that should pull the transitive artifacts as well.
the org.springframework.data.hadoop.config.annotation is included inside
compile group: 'org.springframework.data', name: 'spring-data-hadoop-config', version: '2.4.0.RELEASE'

Gradle properties in 2.6 vs 2.7

If I specify in 'build.gradle' that belongs to the root:
allprojects {
version="1.0-SNAPSHOT"
}
Then I want to use the same version property in a subproject like that:
dependencies {
compile group: 'com.myproject.module', name: 'first', version: allprojects.version
}
In Gradle 2.6: it will put '[1.0-SNAPSHOT]'
In Gradle 2.7: it will be '1.0-SNAPSHOT' without brackets
What can be the reason for that? Is that due to some gradle issues in 2.6? In gradle 2.2.1 - it also works fine. Maybe you could recommend some best practices here?
answer can be found here (I posted the same question on gradle forum): https://discuss.gradle.org/t/gradle-properties-in-2-6-vs-2-7/11919

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"
}
}

could not resolve all dependencies for configuration ':compile'

To study Gradle I am using the book Gradle in action.
There was an example of dependency definition.
dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.1'
}
But when I do in console gradle build I've got an error
What is the problem? My whole .gradle file looks like this
apply plugin: 'java'
dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.1'
}
You did not tell Gradle where to find commons-lang3 library. Easy fix is to add the following to your build script:
repositories {
mavenCentral()
}
Of course you can find this piece of information in documentation - http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html#N10608
I was facing this same issue. I fixed it by using local gradle distribution instead of the default gradle wrapper. This is how it goes, make sure that you have Gradle installed and setup(PATH variable).
Open IntelliJ. Goto File->setting->Build, Exec, Deployment->Build tools->Gradle and use local gradle distribution and add your Gradle Home. Apply changes and try to run it now.

Resources