Gradle cannnot resolve some dependencies while Maven can - maven

I have a Gradle project that requires org.eclipse.hudson:hudson-core:3.3.3. It has been working fine until today, when it just says:
Could not resolve org.eclipse.hudson:hudson-remoting:3.0.3
I created a Maven project with only hudson-remoting:3.0.3, it works fine. The jar is also there on the Maven Central. Gradle is able to resolve hudson-remoting:3.0.2 though, but hudson-core:3.3.3 requires hudson-remoting:3.0.3. What is going on?
plugins {
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.eclipse.hudson:hudson-remoting:3.0.3'
}
The projects uses bundled Gradle 6.8, created by IntelliJ.

Related

unable to create a executable spring boot jar by the bootJar task

basically I need to create a spring boot jar to run system spring-server service on my server
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
ext {
spring_boot_version = '1.5.7.RELEASE'
spring_version = '4.3.11.RELEASE'
}
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/exposed' }
maven { url 'https://jitpack.io' }
maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-releases' }
}
apply plugin: 'kotlin'
apply plugin: 'java'
apply plugin: 'net.corda.plugins.cordformation'
apply plugin: 'net.corda.plugins.quasar-utils'
bootJar {
basName = 'corda-webserver'
version = '1.0.0'
}
How can I achieve this is there something wrong with gradle dependencies or plugins?
I tried springboot task as well
So there's not enough information here to be sure of what the issue could be; so here are a few ideas.
Start by cleaning gradle cache. ./gradlew clean
Obviously the issue here is dependencies, you need to make sure gradle is able to build your project, and download dependencies.
./gradlew deployNodes (if you're using one of the corda sample projects) will build all of the files locally and should pull in the dependencies for you.
R3 now uses software.r3.com as the 'official' link to the artifact repository, you may want to take a look there and maybe look at whether the downloads are still good.
good luck!

Cant resolve rar dependencies in Gradle

I'm having a problem fetching active-mq in my gradle project.
It says Could not find activemq-rar
dependencies {
compile 'org.apache.activemq:activemq-rar:5.15.6'
}
Even after adding the type
dependencies {
compile 'org.apache.activemq:activemq-rar:5.15.6#rar'
}
I remember I have hacked it by adding that dependency manually as an artefact in my Nexus 1 but now when migrated to Nexus 3 and its more strict I can't get this fetched. Any Ideas?
And Nexus 3 is not happy storing rar files at all.
https://issues.sonatype.org/browse/NEXUS-11712
Is this compoennt already in your NXRM repository? If so, since you're running v3.15+, you can simply navigate to the component in NXRM UI and in the right side panel there are dependency snippets that will help you how to include a component in your project. Also, make sure that your build.gradle points to the right repositories.
Here's the config I tried. NXRM proxy to Maven Central:
A minmal build.gradle:
plugins {
id 'java'
}
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
version = '1.0.0-SNAPSHOT'
repositories {
maven {
url 'http://localhost:2001/repository/maven-central'
}
}
dependencies {
implementation 'org.apache.activemq:activemq-rar:5.15.8#rar'
}
Then build your app $ gradle build shich should yield success and you should see the activemq-rar-5.15.8.rar in your repository.

Gradle doesn't find plugins: org.jetbrains.kotlin.jvm and kotlin2js

I'm a beginner in gradle, using version 4.8.
Whatever I do , the plugins are never found. I get this error message:
Plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.3.20'] was not found in any of the following sources:
Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
Plugin Repositories (could not resolve plugin artifact 'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.3.20')
Searched in the following repositories:
Gradle Central Plugin Repository
No matter how many repositories I add, it seems it is only looking in "Gradle Central Plugin Repository"
My gradle.build file:
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20"
classpath "org.jetbrains.kotlin.jvm:kotlin-gradle-plugin:1.3.20"
}
}
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.20'
id 'kotlin2js' version '1.3.20'
}
Can you help me?
Try the following gradle.build configuration:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20"
}
}
plugins {
id 'java'
}
apply plugin: 'kotlin2js'
repositories {
mavenCentral()
}
When you include the plugin by id, it seems Gradle wants to retrieve the plugin from the Gradle plugin portal, but the Kotlin plugin is not there, it's part of the buildscript dependency. Using it with the apply plugin works. You can also find a slightly different working example here.
I had similar problem because i forgot about proxy settings like systemProp.https.proxyHost and systemProp.http.proxyHost and etc. that was set in ~/.gradle/gradle.properties.
I fixed configuration and plugin was successfully dowlnloaded
Check gradle.properties and try to add correct proxy settings if you behind firewall or escape this settings if you not.
you need to add repository mavenCentral() to the buildscript dependencies.
for example: kotlin-gradle-plugin:1.3.20. also the documentation hints for that.
Go to your project and then to the Gradle script. In Gradle, Go to Setting.Gradle and change the Fist Bitray Url to https://plugins.gradle.org/m2/.

Dependenciies in Gradle not working correctly

We have a project that is using Java 1.5 and we are trying to convert from Maven to Gradle.
We have a repository that is local to us containing all the versions of all the jars we need as the dev environment has no access to the internet.
The problem we are seeing is that it cannot find the commons-io jar and keeps trying to goto the external maven repo. we have not even set that up so where is it finding it from?
we have repositories and dependencies set up in the All projects section as follows
allprojects {
apply plugin: 'java'
sourceCompatibility = 1.5
targetCompatibility = 1.5
project.tasks.withType(AbstractCompile, { AbstractCompile ac -> ac.options.bootClasspath = "C:/Program Files/java/1.5.0_14/jre/lib/rt.jar" })
repositories {
mavenLocal()
maven { url "http://internalrepo/maven-local" }
}
dependencies {
compile "org.apache.commons:commons-io:1.3.2"
}
But its reporting
Could not resolve org.apache.commons:commons-io:1.3.2.
inconsistent module metadata found
even though it works fine in Maven using mvn install
Gradle will never query a repo that isn't set up. mavenlocal() is misspelled (should be mavenLocal()), which will make the build fail. "Inconsistent metadata" could mean that the group ID, artifact ID, or version in the POM doesn't match the one in the build script. mavenLocal() should only be used if the Gradle build needs to exchange artifacts with local Maven builds.
Found the issue,
Unbeknownst to me there was a hidden repo in the maven settings.xml in the maven install folder.
Adding that resolved the issue.

How to configure a plugin to depend on a specific version of gradle?

I am writing a set of Gradle plugins, but I want to control the specific versions of groovy and gradle that are used.
I don't want the plugins to depend on whatever versions of Gradle/Groovy are installed, like the following would do:
dependencies {
compile localGroovy()
compile gradleApi()
}
Another reason I don't want to use the local method - when you use a proper dependency specification, Gradle then knows about the source code for those libs and the IDE plugins can hookup the source automatically.
Below are the relevant sections of my build script:
allprojects { Project iProject ->
apply plugin: 'idea'
apply plugin: 'maven'
repositories {
jcenter()
}
}
subprojects { Project iProject ->
apply plugin: 'groovy'
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.2'
}
}
project(':eclipsei2g') {
group = 'eclipsei2g'
version = '0.0.1-SNAPSHOT'
dependencies {
compile 'org.gradle:gradle-core:2.0'
}
}
project(':g2idea13') {
group = 'g2idea13'
version = '0.0.1-SNAPSHOT'
dependencies {
compile 'org.gradle:gradle-core:2.0'
compile 'org.gradle-plugins:gradle-ide:2.0'
}
}
When I run this I get an error resolving the gradle-ide dependency:
Could not resolve all dependencies for configuration ':g2idea13:compile'.
> Could not find org.gradle:gradle-ide:2.0.
Searched in the following locations:
http://jcenter.bintray.com/org/gradle/gradle-ide/2.0/gradle-ide-2.0.pom
http://jcenter.bintray.com/org/gradle/gradle-ide/2.0/gradle-ide-2.0.jar
Required by:
g2idea13:g2idea13:0.0.1-SNAPSHOT
There doesn't seem to be anything on the jcenter repository since 0.9 for the plugins stuff.
I also tried 'org.gradle:gradle-ide:2.0'.
Is this even how I should be doing this? Is there another way to specify a specific gradle version? Am I just using the wrong repository? I couldn't even get gradle-core to resolve on mavenCentral(). Is there an official Gradle repository somewhere that I should be using?
gradleApi() is the way to go. There isn't currently a public list of dependencies for Gradle plugins.

Resources