How do I specify a dependency that end with '<version>-bin.exe' in gradle? - gradle

How do I get
winsw-1.19-bin.exe from the repo below:
repositories {
maven {
url 'http://repo.jenkins-ci.org/releases'
}
}
dependencies {
compile('com.sun.winsw:winsw:1.19#exe')
}
The above returns:
* What went wrong:
Could not resolve all dependencies for configuration ':compileClasspath'.
> Could not find winsw.exe (com.sun.winsw:winsw:1.19).
Searched in the following locations:
http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/1.19/winsw-1.19.exe

Seems that I was missing the classifier
compile('com.sun.winsw:winsw:1.19:bin#exe')
or
compile(group: 'com.sun.winsw', name: 'winsw', version: '1.19', classifier: 'bin', ext: 'exe')

Related

Why does the liberty-gradle-plugin fail on CompileJSP?

I am trying to get the liberty-gradle-plugin to run. I created a minimal build.gradle and it still fails:
plugins {
id 'io.openliberty.tools.gradle.Liberty' version '3.0'
id 'war'
}
repositories {
jcenter()
}
dependencies {
providedCompile group: 'javax', name: 'javaee-api', version: '8.0.1'
libertyRuntime group: 'com.ibm.websphere.appserver.runtime', name: 'openliberty-runtime', version: '[20.0.0.2,)'
}
It fails with:
An exception occurred applying plugin request [id: 'io.openliberty.tools.gradle.Liberty', version: '3.0']
> Failed to apply plugin [id 'io.openliberty.tools.gradle.Liberty']
> Could not create task ':compileJSP'.
> Could not create task of type 'CompileJSPTask'.
> Could not generate a decorated class for class io.openliberty.tools.gradle.tasks.CompileJSPTask.
> io/openliberty/tools/ant/ServerTask
I have no intention to use JSP. So is there a way to fix this? Or to disbale the JSP part?
It looks like it is a bug: https://github.com/OpenLiberty/ci.gradle/issues/441
The using the buildscript version works for now.

Gradle Build Failure for JasperReports: Dependency Issue

My build.gradle is as follows:
// https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports
compile group: 'net.sf.jasperreports', name: 'jasperreports', version: '6.9.0'
// https://mvnrepository.com/artifact/com.lowagie/itext
compile group: 'com.lowagie', name: 'itext', version: '2.1.7.js6'
repositories {
maven {
url 'https://repo.spring.io/libs-milestone'
}
maven {
url 'http://maven.icm.edu.pl/artifactory/repo/'
}
The error I am getting is as follows.
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all files for configuration ':Services:compileClasspath'.
Could not find com.lowagie:itext:2.1.7.js6.
Required by:
project :Services
project :Services > net.sf.jasperreports:jasperreports:6.9.0
Reference link: https://mvnrepository.com/artifact/com.lowagie/itext/2.1.7.js6
What is going wrong here? Please help.
Adding these to the repositories fixed the issue for me
repositories {
mavenCentral()
maven{url "http://jasperreports.sourceforge.net/maven2/"}
maven{url "http://jaspersoft.artifactoryonline.com/jaspersoft/third-party-ce-artifacts/"
}
}
dependencies {
...
implementation 'net.sf.jasperreports:jasperreports:6.1.0'
...
}

Gradle not imported dependency with ext:pom

I want import library org.geotools.
Added raw compile group: 'org.geotools', name: 'geotools', version: '16.1'
or compile group: 'org.geotools', name: 'geotools', version: '16.1', ext: 'pom'
and repo:
repositories {
mavenLocal()
maven { url 'http://repo.boundlessgeo.com/main' }
maven { url "http://download.osgeo.org/webdav/geotools/" }
maven { url "http://download.java.net/maven/2" }
maven { url "http://repo.opengeo.org" }
mavenCentral()
}
BUILD SUCCESSFUL in 47s
but in external libraries it not found.
I not a gradle user but don't you need to add some actual dependencies?
For GeoTools I usually start with at least some of these:
gt-main
gt-metadata
gt-referencing
and a datasource or 2.

Gradle war plugin pulls in javadoc and sources

I have a strange problem. I have a project which creates a war file with some custom inclusions like images etc. So far it looks good. The only problem left is that gradle pulls in source jars/zips and javadoc jars/zip into my WEB-INF/lib/ folder of my war.
I thought it might be a problem with Idea but same results with the command line. I guess it has something to do with the dependency configuration?
I use compile and runtime scopes and my artifacts are resolved from Artifactory.
Can anyone point me to a direction where to fix that?
Update:
When i create a task:
task copyAllDependencies(type: Copy) {
from configurations.runtime
into 'allRuntime'
}
or
task copyAllDependencies(type: Copy) {
from configurations.compile
into 'allCompile'
}
I'll get the sources as well. So it seems that it has something to do with the compile/runtime configuration. They're pulling the sources and javadoc. But why?!
Dependencies are declared like this:
dependencies {
compile group: 'org.drools', name: 'drools-core', version: DROOLS_VERSION
compile group: 'org.drools', name: 'drools-compiler', version: DROOLS_VERSION
...
runtime group: 'net.sourceforge.barbecue', name: 'barbecue', version: '1.5-beta1', ext: 'jar'
...
testCompile group: 'org.fitnesse', name: 'fitnesse', version: '20130531'
...
}
Here's another attempt... a bit hacky but might work
configurations {
tempCompile
tempRuntime
tempTestCompile
}
dependencies {
tempCompile "org.drools:drools-core:${DROOLS_VERSION}"
tempRuntime "net.sourceforge.barbecue:barbecue:1.5-beta1#jar"
tempTestCompile "org.fitnesse:fitnesse:20130531"
...
compile configurations.tempCompile.asFileTree.matching {
exclude '**/*-sources.jar'
exclude '**/*-javadoc.jar'
}
runtime configurations.tempRuntime.asFileTree.matching {
exclude '**/*-sources.jar'
exclude '**/*-javadoc.jar'
}
testCompile configurations.tempTestCompile.asFileTree.matching {
exclude '**/*-sources.jar'
exclude '**/*-javadoc.jar'
}
}
As we discovered in the comments, your dependencies are bringing in javadoc and sources as transitive dependencies. You can possibly exclude these by
configurations.all { Configuration config ->
['com.group1', 'com.group2', ..., 'com.groupN'].each { groupId ->
config.exclude [group: groupId, classifier: 'javadoc']
config.exclude [group: groupId, classifier: 'sources']
}
}
Note: I'm not an ivy user so the selector (classifier: 'javadoc' etc) may need tweaking

gradle Could not resolve all dependencies for configuration ':compile'

I have a dependencies problem I need help with.
I can build EGLSource fin on its own.
But when i try to build EGL2JS then I get this error:
Error message:
:compileJava
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not find :swt-64:.
Searched in the following locations:
https://repo1.maven.org/maven2//swt-64//swt-64-.pom
https://repo1.maven.org/maven2//swt-64//swt-64-.jar
Required by:
:EGL2JS:unspecified > EGL2JS:EGLSource:unspecified
Build and settings files for the two projects: EGLSource and EGL2JS.
EGL2JS: settings.gradle
include ':EGLSource'
project(':EGLSource').projectDir = new File(settingsDir, '../EGLSource')
EGL2JS: build.gradle
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile project(':EGLSource')
}
sourceSets {
main {
java.srcDirs = ['src', 'target/generated-sources']
}
}
EGLSource: build.gradle
apply plugin: 'java'
repositories {
flatDir {
dirs 'lib'
}
}
dependencies {
compile name: 'swt-64'
}
sourceSets {
main {
java.srcDirs = ['src', 'target/generated-sources/antlr4']
}
}
Why is EGL2JS complaining about a dependency in EGLSource?
I could add the swt-64.jar to EGL2JS. But EGL2JS does not directly depend on swt-64.jar so I don't like that solution.
Are there other ways to resolve this dependency?
For reasons I don't understand this makes a difference.
Removing flatFile from repositories
and changing dependencies
from:
compile name: 'swt-64'
to:
dependencies {
compile fileTree(dir: 'lib', include: 'swt-64.jar')
}
Also gradle dependencies not longer shows swt-64 failed.

Resources