Gradle does not download complete dependencies - hadoop

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'

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.

spring boot plugin and gradle dependency implementation

We have been using gradle spring boot plugin version 1.5.14 and gradle 4.10.3 for our builds. After an upgrade of gradle to 6.2.2, we've also changed dependency-definition from compile group to implementation group i.e.:
compile group: 'org.springframework.boot', name: 'spring-boot-starter-integration'
to
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-integration'.
The fat jar created via gradle assemble does to my surprise not contain the required libs under BOOT-INF/lib anymore? If I replace "implementation" with "compile" it works again as expected.
Is there something which needs to be configured so that spring-boot-plugin adds them? Or do I need to upgrade the project to spring boot 2 beforehand?
Implementation will bring in the dependency only for that module it is declared in.
Compile will allow a module that depends on the module to use the dependency as well.
Say you have Module A depending on Module B.
Module A and B both need the dependency:
com.font:font1:1.1.1
If B uses:
implementation 'com.font:font1:1.1.1'
A will not see font1, and will need to bring it into its own build.gradle file as well.
compile 'com.font:font1:1.1.1'
will make it available to the entire classpath (which should be avoided anyway, and the new equivalent is for libraries which uses 'api' instead of 'compile').
Without seeing your project directory, I'm assuming that some dependency is not being pulled into a place where it used to be grabbed from a lower dependency in the hierarchy. You should be able to find the missing dependencies easily by changing compile to implementation one at a time, unless you have a huge multi-module project.

Eclipse: How can I have gradle dependencies deployed to Tomcat

I'm creating a web project using Gradle (buildship) in Eclipse (WTP). I've put the libraries I need as "implementation" dependencies in my build.gradle, however they are not copied to Tomcat when I try to run the project from within Eclipse. When I build the WAR file (with gradle war), however, all the jar files are there.
I can't find anywhere the solution for this. It's beeing awful to manually (and redundantly) copying every jar and its dependency to WEB-INF/libs just to be able to run the app from Eclipse).
I've found a workaround here: https://github.com/eclipse/buildship/issues/496
It's adding this to build.gradle:
eclipse {
wtp {
component {
libConfigurations += [configurations.runtimeClasspath]
}
}
}
With this everything gets properly deployed.
UPDATE!
Gradle 5.3 has just been released and includes a fix for this issue and the hack above is not needed anymore.
The only thing that worked for me was changing
dependencies {
implementation group: 'org.projectlombok', name: 'lombok', version: '1.18.4'
}
too
dependencies {
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.4'
}

OSGI com.sun.image import using gradle

Im my project i use the following dependencies to build a captcha in gradle module and deploy it to liferay 7
dependencies{
compile group: 'com.octo.captcha', name: 'jcaptcha', version: tcVersion('com.octo.captcha')
// compile group: 'com.octo.captcha', name: 'jcaptcha-api', version: '2.0-alpha-1'
compile group: 'com.jhlabs', name: 'filters', version: '2.0.235-1'
}
the problem is when i try to deploy my bundle i get the following error
org.osgi.framework.BundleException: Could not resolve module: com.myproject.vaadin.util [810]
Unresolved requirement: Import-Package: com.sun.image.codec.jpeg
apparently, com.sun.image.codec.jpeg is being used. it is in rt.jar in the jdk so i dont need to extra include it, but it seems that i should include it. in gradle the project compiles successfuly and the bundle gets deployed in the gogo shell but when i try to start the bundle i get the descriped error
You dependency is not available in your runtime for your module. When building in Gradle it is available, as mentioned, because it is on your build classpath. In runtime however, you module declares that it needs to import this package from a OSGi bundle, which does not exist.
You have some options to explore here. You can use compileInclude to include the library in a fat Jar in Gradle (Liferay workspace); use the bnd file to include as a resource and set the bundle's classpath to include the jar; build a uber module that carries the package you need to the runtime in its on bundle; or find a bundle that exports it without you needing to build extra stuff.
Bottom line: you need to make the package available in runtime as an exported package.
You will need to configure boot delegation for the OSGi framework to include the com.sun.image.codec.jpeg package.

Process a subset of my dependencies in Gradle

I have a simple project where I'd like to unjar a subset of my dependencies and pack them into the output jar.
I have the two configurations:
configurations {
embed
all
}
dependencies {
embed group: 'commons-collections', name: 'commons-collections', version: '3.2'
...
all embed
all group: 'something-not-embeddable', name: 'dontembed'
compile all
}
According to http://www.gradle.org/docs/current/userguide/dependency_management.html 50.5 Working with Dependencies section's example it should work.
In a later section of my build, I want to unjar the embed jars and use them as source for jar.
My problem is that the gradle output says:
> Could not find method all() for arguments [configuration ':embed'] on root project 'myproject'.
Can you tell me why my approach is not working and how could I fix it?
Lol, looks like I chose a bad configuration name, works with alldeps instead of all

Resources