Gradle import failed (Unable to resolve com.comphenix.protocol:ProtocolLib-API:4.3.0
bindingflare opened this issue ยท 6 comments
Versions
- Java 10.0.1
- Spigot 1.12.2-R01
- IntelliJ IDE
- Gradle 4.7 (Supports Java 10)
Other plugins in use (With ProtocolLib) for my plugin project
- Vault
- SaneEconomy
- WorldGaurd
- WorldEdit
Use intent
Wanted to start using ProtocolAPI for my plugin to modify/ create packets.
Problem
After following instructions to setting up the gradle.build Gradle kept on failing to import (error on title).
Steps taken after problem
First thing I did was try it with ProtocolLib instead of ProtocolLib-API. Still did not work.
After some digging, I found some interesting stuff. I looked up the repo link and found that there is no such directory of "com.comphenix.protocol" in the "public" database folder, but instead in the "releases" database.
I also realised changing the URL to "http://repo.dmulloy2.net/nexus/repository/releases/" will still not work probably because that is not how Maven/ Gradle repos work (Im guessing its simply not just a folder with directories but more complicated)
In the end, I decided to just import it locally by downloading v4.3.0, putting it in a "libs" folder and importing using Gradle through "compile fileTree(dir: 'libs', include: '*.jar')"
build.gradle settings
(The one that works for now by commenting the line importing ProtocolLib by the maven URL for it)
build.gradle
apply plugin: 'java'
apply plugin: 'maven'
group = 'io.github.flintintoe'
version = '0.1.0'
description = "A Minecraft Spigot plugin for customizable sidebars"
sourceSets.main.resources.srcDirs = [ "src/main/java" ]
sourceSets.main.resources.includes = [ "**/*.yml" ]
compileJava {
sourceCompatibility = '1.10'
targetCompatibility = '1.10'
}
repositories {
maven { url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" }
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = "http://nexus.hc.to/content/repositories/pub_releases" }
maven { url = "http://maven.sk89q.com/repo/" }
maven { url = "http://repo.maven.apache.org/maven2" }
//maven { url = "http://repo.dmulloy2.net/nexus/repository/releases/"}
mavenCentral()
}
dependencies {
compile group: "com.sk89q.worldguard", name: "worldguard-legacy", version: "6.2";
compile group: "org.spigotmc", name: "spigot-api", version: "1.12.2-R0.1-SNAPSHOT"
//compile group: "org.bukkit", name: "bukkit", version: "1.12.2-R0.1-SNAPSHOT"
compile group: "net.milkbowl.vault", name: "VaultAPI", version: "1.6"
// compile group: "com.comphenix.protocol", name: "ProtocolLib-API", version: "4.3.0"
compile fileTree(dir: 'libs', include: '*.jar')
testCompile group: 'junit', name: 'junit', version: '4.12'
}
aaah, this I can work with.
it looks like that the stable 4.3.0 refers to the snapshot parent pom v4
adding the snapshot repo to your build script should fix it
http://repo.dmulloy2.net/nexus/repository/snapshots/
@dmulloy2 this really shouldn't be the case, do you make changes to the parent pom often? it might be a good idea to release a version of the parent project into the releases repo (or just give in an use snapshot for everything :D)
Put in the url "http://repo.dmulloy2.net/nexus/repository/snapshots/" and got this error.
I think I should just download it and put it in my libs folder where I can import though Gradle locally.
Error log
* What went wrong:
Could not resolve all files for configuration ':compileClasspath'.
> Could not resolve com.comphenix.protocol:ProtocolLib-API:4.3.0.
Required by:
project :
> Could not resolve com.comphenix.protocol:ProtocolLib-API:4.3.0.
> inconsistent module metadata found. Descriptor: com.comphenix.protocol:ProtocolLib-API:${minorVersion} Errors: bad version: expected='4.3.0' found='${minorVersion}'
> Could not resolve com.comphenix.protocol:ProtocolLib-API:4.3.0.
> Could not get resource 'http://repo.dmulloy2.net/nexus/repository/snapshots/com/comphenix/protocol/ProtocolLib-API/4.3.0/ProtocolLib-API-4.3.0.pom'.
> Could not HEAD 'http://repo.dmulloy2.net/nexus/repository/snapshots/com/comphenix/protocol/ProtocolLib-API/4.3.0/ProtocolLib-API-4.3.0.pom'. Received status code 400 from server: Repository version policy: SNAPSHOT does not allow version: 4.3.0
the url to the 4.3.0 artifact is http://repo.dmulloy2.net/nexus/repository/releases/com/comphenix/protocol/ProtocolLib-API/4.3.0/ProtocolLib-API-4.3.0.jar
that means that your build file looks good to me. maven repos are just some folders, but its not browseable in nexus 3.
I would suggest running with the whatever gradle uses to refresh dependencies and see if it attempts to resolve the jar from dmulloys repo.
From what I could make of it, it looks like parent directory "com.comphenix.protocol:ProtocolLib-Parent:v4-SNAPSHOT" is missing. *(shouldn't say missing, but a 400 bad request error)
error log
> Could not resolve com.comphenix.protocol:ProtocolLib-API:4.3.0.
Required by:
project :
> Could not resolve com.comphenix.protocol:ProtocolLib-API:4.3.0.
> Could not parse POM http://repo.dmulloy2.net/nexus/repository/releases/com/comphenix/protocol/ProtocolLib-API/4.3.0/ProtocolLib-API-4.3.0.pom
> Could not resolve com.comphenix.protocol:ProtocolLib-Parent:v4-SNAPSHOT.
> Could not resolve com.comphenix.protocol:ProtocolLib-Parent:v4-SNAPSHOT.
> Unable to load Maven meta-data from http://repo.dmulloy2.net/nexus/repository/releases/com/comphenix/protocol/ProtocolLib-Parent/v4-SNAPSHOT/maven-metadata.xml.
> Could not get resource 'http://repo.dmulloy2.net/nexus/repository/releases/com/comphenix/protocol/ProtocolLib-Parent/v4-SNAPSHOT/maven-metadata.xml'.
> Could not GET 'http://repo.dmulloy2.net/nexus/repository/releases/com/comphenix/protocol/ProtocolLib-Parent/v4-SNAPSHOT/maven-metadata.xml'. Received status code 400 from server: Repository version policy: RELEASE does not allow metadata in path: com/comphenix/protocol/ProtocolLib-Parent/v4-SNAPSHOT/maven-metadata.xml
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
The parent usually only changes with Spigot versions. One will get added to the releases repo after 4.4.0, in the next couple of days