Download dependencies from url and extract to a folder using gradle - gradle

I am a gradle newbie. I see that gradle supports maven and ivy out of the box, however I have a need where the dependency for a java project is to be downloaded from a url. The dependencies are actually jar files which are zipped, I also need it to be extracted.

Related

Gradle dependencies pom files locations on local file system

I understand that Gradle stores project dependencies cache in ~/.gradle/caches/modules-2 for the actual jar files. However, does Gradle also store .pom anywhere locally? Also, if I previously downloaded same dependencies through Maven (stored in ~/.m2/repositories) would Gradle reuse them automatically? In Maven, pomfiles are downloaded along side jars.
If POMs are not downloaded as part of gradle build, what's the best way to programmatically get the POMs for package metadata?
Gradle seems to use a local cache and not a repository, unless depending on mavenLoacal().
You could use the API which mavenCentral() provides:
https://central.sonatype.org/search/rest-api-guide

How does a jar pull transitive dependencies in Maven?

I am buliding small Spring Boot app - pacakged as jar file (I'm using maven plugins).
I know that there are solutions which allow me to build jar file with all desired dependecies (e.g. maven assembly plugin).
The question is what if I don't pack maven required depedencies using those solutions? Am I correct that I will always get "NoClassDefFoundError" ? So should I always pack my project with all depedencies into jar file or there is another solution to "makes thigns work"?

Update Maven Dependencies Jars

I am new to Maven and have a quick question. I am using the JBoss IDE and have my Maven project set up. I have several jar files in my Maven Dependencies build path that need to be updated to a newer version. I have tried adding the external jars manually, but they do not go within the Maven Dependencies library and the outdated jar remains within that library.
What is the best way to update the jars with the Maven Dependencies library?

Can we use Maven Dependency in Gradle Project Remotely

I am trying to host maven Dependency basically which I can use in Some other Gradle project.
I have also try this locally but I want to do it remotely.
I also try to do this in some other manner - I just host one jar file in tomcat server and tried to download in my gradle project.
"http://10.10.177.157:8080/face_rec/images/jmf-2.1.1e.jar" this is the hosted jar path in which we can eaisly download jar file by hitting this ulr.And "C:/Users/USERNAME/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar" this is my local .m2 repository.
In this gradle project I can easily download the jar files using compile files ("C:/Users/USERNAME/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar") but I am not able to download hosted jars i.e - http://10.10.177.157:8080/face_rec/images/jmf-2.1.1e.jar
Can someone give me any idea about this that how can it is possible.
thanks

How to add a plugin as a jar to a grails project

I created a custom plugin 'myPlugin' for GRAILS. I compiled and installed it as a binary (my-plugin-0.1.jar) file.
The jar file can't be found by grails in a "normal" project, because it only looks for my-plugin-0.1.zip (the plugin is defined within the plugins-block in BuildConfig.groovy)
How can i add the .jar file as a plugin?
Binary plugins packaged as jar has to be referred in the dependencies section instead of the plugins section in BuildConfig
dependencies {
compile "mygroup:myplugin:0.1"
}
or you can put the jar in application's lib directory which I would discourage. :)
Add it in the dependencies block (not plugins) in BuildConfig.groovy.
Publish plugin installs the jar into local maven cache (/.m2). Verify the existence of the jar in .m2.
Also verify if the application using the plugin has mavenLocal enabled in repositories' buildConfig.

Resources