Could not resolve: org.jetbrains.pty4j:pty4j:0.9.8 - gradle

In my build.gradle file.
repositories {
maven {
url "https://jetbrains.bintray.com/pty4j"
}
mavenCentral()
}
dependencies {
implementation group: 'org.jetbrains.pty4j', name: 'pty4j', version: '0.9.8'
}
If I build my project it comes like this
Could not resolve org.jetbrains.pty4j:pty4j:0.9.8.
Possible solution:
- Declare repository providing the artifact, see the documentation at
https://docs.gradle.org/current/userguide/declaring_repositories.html
screen shot
How can I solve this error ?

That particular artefact is not provided by MavenCentral() but rather by the Spring Release Repository. One useful trick to find out which repositories provide a given artefact is to seek your artefact here and pay attention to the repositories link provided.
You'll need then to change your Gradle config to something like:
repositories {
mavenCentral()
maven { url "https://packages.jetbrains.team/maven/p/ij/intellij-dependencies" }
}

Related

Could not find com.github.everit-org.json-schema:org.everit.json.schema

I'm trying to add the below dep in my build.gradle and added the below repos but it's still not able to download the dep.
repositories {
maven {
url 'http://packages.confluent.io/maven/'
}
maven {
url "https://repository.mulesoft.org/nexus/content/repositories/public/"
}
maven { url 'https://jitpack.io' }
jcenter()
mavenCentral()
mavenLocal()
}
Below is the error I'm getting:
> Could not find com.github.everit-org.json-schema:org.everit.json.schema:.
Required by:
project :<my-project-module-name>
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
its my mistake, I've added an extra colon while defining the gradle dependencies..So, it worked after removing it.

Gradle can't find dependency in private nexus repo

I'm having trouble getting gradle to find a dependency I put in my private nexus repo. The dependency is in maven, but I can't seem to get it to find it there either. I did get it into my nexus repo and the location is http://nexus.hq.chris.com/content/repositories/emoji4j/
Could not resolve all dependencies for configuration ':business:compile'.
> Could not find com.kcthota:emoji4j:6.0.
Searched in the following locations:
http://nexus.hq.chris.com/content/groups/public/com/kcthota/emoji4j/6.0/emoji4j-6.0.pom
http://nexus.hq.chris.com/content/groups/public/com/kcthota/emoji4j/6.0/emoji4j-6.0.jar
file:/Users/chris/.m2/repository/com/kcthota/emoji4j/6.0/emoji4j-6.0.pom
file:/Users/chris/.m2/repository/com/kcthota/emoji4j/6.0/emoji4j-6.0.jar
Required by:
Build.gradle snipet
dependencies {
// https://mvnrepository.com/artifact/com.kcthota/emoji4j
compile group: 'com.kcthota', name: 'emoji4j', version: '6.0'
}
buildscript {
repositories {
maven {
url "http://nexus.hq.chris.com/content/groups/public/"
}
maven { url "https://repo1.maven.org/maven2/" }
maven { url "http://nexus.hq.chris.com/content/repositories/emoji4j/" }
mavenCentral()
}
dependencies {
classpath 'com.jcraft:jsch:0.1.54'
}
}
Anyone know how I can get gradle to look in both http://nexus.hq.chris.com/content/groups/public/ and http://nexus.hq.chris.com/content/repositories/emoji4j/ for all my dependencies? I need the http://nexus.hq.chris.com/content/groups/public/ location for other dependencies. I tried adding it in there but I only have read access to that repo.
Another acceptable solution would be to get gradle to look in both http://nexus.hq.chris.com/content/groups/public/ and maven central for it. Any help would be appreciated.
I think you may be confusing dependencies for your build script and application dependencies.
You've configured your build script repositories, but you'll need to also configure your application repositories as well:
// build.gradle
repositories {
maven {
url "http://nexus.hq.chris.com/content/groups/public/"
}
maven { url "https://repo1.maven.org/maven2/" }
maven { url "http://nexus.hq.chris.com/content/repositories/emoji4j/" }
mavenCentral()
}

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/.

how to specify multiple mavenRepo's in build.gradle?

I would like to use multiple mavenRepo's in my build:
repositories {
mavenLocal()
mavenCentral()
mavenRepo {
url: "http://cloudant.github.io/cloudant-sync-eap/repository/"
url: 'https://github.com/snowch/sync-android-p2p/raw/master/repository/'
}
}
However, the build fails with an error similar to this:
> Could not find method mavenRepo() for arguments [...] on repository container.
How can I specify multiple mavenRepo's?
Note: I'm using an old version of gradle and therefore need to use the deprecated mavenRepo statement.
According to the official Gradle 1.1 documentation, you should be able to use the newer url attribute as follows:
repositories {
mavenLocal()
mavenCentral()
maven { url 'http://cloudant.github.io/cloudant-sync-eap/repository/' }
maven { url 'https://github.com/snowch/sync-android-p2p/raw/master/repository/' }
}
As this Gradle discussion mentions, you should only use one URL per maven block.

Is it possible to restrict a gradle repository to a particular configuration?

I want to tie gradle repositories to specific configurations in my build.gradle file, e.g.:
repositories {
testCompile {
mavenCentral()
}
compile {
maven { url 'https://vetted-repo.example.com' }
}
}
I can't find a simple way to do this from the gradle documentation. Do I need to write my own plugin?
As of Gradle 5.1 this is now possible, from the release notes:
It is now possible to match repositories to dependencies, so that
Gradle doesn't search for a dependency in a repository if it's never
going to be found there.
Example:
repositories {
maven {
url "https://repo.mycompany.com"
content {
includeGroupByRegex "com\\.mycompany.*"
}
}
}
For the specific requirement of restricting a repository to a specific configuration such as compile, you could use the onlyForConfigurations property:
repositories {
maven {
url "https://vetted-repo.example.com"
content {
onlyForConfigurations "compile"
}
}
}
This is not supported by gradle at the moment. When resolving dependencies, gradle tries al listed repositories (from top to bottom) to resolve a dependency. Once the dependency is found it stops looking for it in other repositories
It is now possible to declare a repository filter in gradle. see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html#declaring_a_repository_filter this does exactly what you need here.

Resources