How to define pool of jars as dependency in gardle

software-model

(ghanshyam) #1

I have 110 jars under Novus-CM.Linux64.jdk18/novus/16.7.0.1 and I want to give reference at run time.

can someone please tell me how to do that

apply plugin: 'java’
apply plugin: ‘application’

repositories {
mavenCentral()
maven {
url ‘https://bams-sami.int.thomsonreuters.com/artifactory/list/default.generic.global/
}

         }

project.ext {
Version = ‘0.0.0’
}
group 'com.trgr.platform’
sourceCompatibility = 1.8
mainClassName = “Dev.one”

jar {
manifest {
attributes ‘Main-Class’: mainClassName

}

}

task sourcesJar(type: Jar) {
baseName = "$project.name"
classifier = 'sources’
from sourceSets.main.allSource
}

dependencies {
compile (group: ‘Novus-CM.Linux64.jdk18’, name: ‘novus’, version: ‘16.7.1’ )
//{ transitive = false }
compile(group: ‘’, name: ‘jars’, version: ‘0.0.0’) {
transitive = false
}
}


(Lance Java) #2
ext {
   novusRoot = 'c:/Novus-CM.Linux64.jdk18/novus/16.7.0.1'
}
dependencies {
   compile fileTree(novusRoot).matching {
      include '**/*.jar'
   }
}

(ghanshyam) #3

thanks Lance,

I used.

ext {
novusRoot = ‘https://bams-sami.int.thomsonreuters.com/artifactory/webapp/#/artifacts/browse/tree/General/default.generic.global/Novus-CM/Linux64/jdk18/novus/16.7.1
}
dependencies {
compile fileTree(novusRoot).matching {
include ‘**/*.jar’
}

but getting below error:

  • What went wrong:
    Could not resolve all dependencies for configuration ‘:compileClasspath’.

Cannot convert URL ‘https://bams-sami.int.thomsonreuters.com/artifactory/webapp/#/artifacts/browse/tree/General/default.generic.global/Novus-CM/Linux64/jdk18/novus/16.7.1’ to a file.


(Lance Java) #4

Unfortunately an http “folder” and a local directory arent interchangable like that :slight_smile:
I’m not able to see your repository, are you able to download a zip/tar containing all the jars?

Eg:

configurations {
   novus { transitive = false }
}
dependencies {
   novus 'Novus-CM.Linux64.jdk18:novus:16.7.1@zip' // notice the @zip
   compile zipTree(configurations.novus.singleFile).matching {
      include '**/*.jar'
   }
}

(ghanshyam) #5

I not able to get entire jars in a folder as zip, but I am able to download each jar individually
.


(Lance Java) #6

If it’s a standard “apache” style web page, you might be able to use the org.apache.ivy.util.url.ApacheURLLister to list the files. See here for an example of using it in combination with the gradle-download-task