DiscordSRV

DiscordSRV

86.8k Downloads

Adding DiscordSRV as a dependency in Kotlin plugins built with Maven causes the build to error

eirikh1996 opened this issue ยท 1 comments

commented

Hello. I am writing a plugin in Kotlin that will have DiscordSRV as a dependency. However there is a problem: When having the Maven dependency added, the build errors:

[INFO] Building io.github.eirikh1996 Factions3Chat 1.0
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from jcenter: http://jcenter.bintray.com/net/dv8tion/JDA/4.0.0_56/JDA-4.0.0_56.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.188 s
[INFO] Finished at: 2020-01-18T22:41:57+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project Factions3Chat: Could not resolve dependencies for project io.github.eirikh1996:Factions3Chat:jar:1.0: Failed to collect dependencies at com.discordsrv:discordsrv:jar:1.
18.3 -> net.dv8tion:JDA:jar:4.0.0_56: Failed to read artifact descriptor for net.dv8tion:JDA:jar:4.0.0_56: Could not transfer artifact net.dv8tion:JDA:pom:4.0.0_56 from/to jcenter (http://jcenter.bintray.com):
Access denied to: http://jcenter.bintray.com/net/dv8tion/JDA/4.0.0_56/JDA-4.0.0_56.pom -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Here is how the pom is setup:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>io.github.eirikh1996</groupId>
    <artifactId>Factions3Chat</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>

    <name>io.github.eirikh1996 Factions3Chat</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <kotlin.version>1.3.61</kotlin.version>
        <kotlin.code.style>official</kotlin.code.style>
        <junit.version>4.12</junit.version>
    </properties>

    <repositories>
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>Scarsz-Nexus</id>
            <url>https://nexus.scarsz.me/content/groups/public/</url>
        </repository>
    </repositories>

    <dependencies>

        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jdk8</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test-junit</artifactId>
            <version>${kotlin.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test</artifactId>
            <version>${kotlin.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.bukkit</groupId>
            <artifactId>bukkit</artifactId>
            <version>1.15.1-R0.1-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.massivecraft</groupId>
            <artifactId>MassiveCore</artifactId>
            <version>3.2.3</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/libs/MassiveCore.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>com.massivecraft</groupId>
            <artifactId>Factions</artifactId>
            <version>3.2.3</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/libs/Factions.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>com.discordsrv</groupId>
            <artifactId>discordsrv</artifactId>
            <version>1.18.3</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>src/main/kotlin</sourceDirectory>
        <finalName>Factions3Chat</finalName>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jvmTarget>1.8</jvmTarget>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

If I omit the DiscordSRV dependency, it builds without problems

commented

fixed 54c553a