Search code examples
mavenjitpack

Jitpack.io not finding dependency


I am currently trying to use a GitHub project as a maven dependency but I always get the Could not find artifact com.github.WolfyScript:CustomCrafting:pom:master-SNAPSHOT in mavenCentral (https://repo1.maven.org/maven2/) line. My pom.xml looks as follows:

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

    <artifactId>[...]</artifactId>
    <groupId>[...]</groupId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>GrapesRPG</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <kotlin.code.style>official</kotlin.code.style>
        <kotlin.compiler.jvmTarget>17</kotlin.compiler.jvmTarget>
        <kotlin.version>1.6.20</kotlin.version>
    </properties>

    <distributionManagement>
        [...]
    </distributionManagement>

    <repositories>
        <repository>
            <id>mavenCentral</id>
            <url>https://repo1.maven.org/maven2/</url>
        </repository>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
        [...]
    </repositories>

    <build>
        <finalName>${project.name}-${project.version}</finalName>
        <sourceDirectory>src/main/kotlin</sourceDirectory>
        <testSourceDirectory>src/test/kotlin</testSourceDirectory>
        <resources>
            <resource>
                <filtering>true</filtering>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
        <plugins>
            [...]
        </plugins>
    </build>

    <dependencies>
        [...]
        <dependency>
            <groupId>com.github.WolfyScript</groupId>
            <artifactId>CustomCrafting</artifactId>
            <version>master-SNAPSHOT</version>
        </dependency>
    </dependencies>
</project>

I even copied the ´dependency´-block and the ´repository´ block directly from jitpack.io's website.

In my ´settings.xml´ I only have the access token to my maven repo. Anything else I need to put in there maybe?

Thank you for taking your time to read my question.


Solution

  • The problem is probably with the WolfyScript/CustomCrafting GitHub repository, as the maven project inside can't be build by default.

    Jitpack runs mvn install -DskipTests by default

    There are at least two problems with the project:

    1. it is using maven-shade-plugin 3.3.0-SNAPSHOT that is not available in maven central repository
    2. it has a dependency on other wolfyscript artifact, that is not present in the same repository / maven project and it (probably) should download it from the defined private repository that requires authentication:
    authentication failed for https://maven.wolfyscript.com/repository/private/com/wolfyscript/wolfyutilities/wolfyutilities/3.16.3.2/wolfyutilities-3.16.3.2.pom, status: 401 Unauthorized
    

    That project is located here: https://github.com/WolfyScript/WolfyUtilities

    To be able to use that repository with jitpack, its author should fix the mentioned problems and/or configure jitpack to be able to build the project