Search code examples
javaeclipsemavengithubjitpack

How to use GitHub Repo using JitPack.io in Maven


I wants to use https://github.com/liquibase/liquibase version 3.5.0-SNAPSHOT

I have added the following in pom.xml

<dependency>
            <groupId>liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
            <version>3.5.0-SNAPSHOT</version>
        </dependency>

<repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
</repository>

but got following error when compile:

[ERROR] Failed to execute goal on project XYZ: Could not resolve dependencies for project com.XYZ:jar:0.0.1-SNAPSHOT: Failure to find org.liquibase:liquibase-core:jar:3.5.0-SNAPSHOT in https://github.com/liquibase/liquibase was cached in the local repository, resolution will not be reattempted until the update interval of liquibase-repository has elapsed or updates are forced -> [Help 1]


Solution

  • There seems to be an issue with JitPack and downloading this repository. According to the maven modular example that JitPack provides, the dependency should be defined as follows:

    <dependency>
        <groupId>com.github.User.Repo</groupId>
        <artifactId>Module</artifactId>
        <version>Commit/Tag</version>
    </dependency>
    

    The following should then work:

    <dependency>
        <groupId>com.github.liquibase.liquibase</groupId>
        <artifactId>liquibase-core</artifactId>
        <version>f7f3b8f60b</version>
    </dependency>
    

    But it also fails resolving the dependency:

    [ERROR] Failed to execute goal on project my-app: Could not resolve dependencies for project com.mycompany.app:my-app:jar:1.0-SNAPSHOT: Failure to find com.github.liquibase.liquibase:liquibase-core:jar:0885bc4 in https://jitpack.io was cached in the local repository, resolution will not be reattempted until the update interval of jitpack.io has elapsed or updates are forced -> [Help 1]

    You can see that this is definitely an issue by just trying to use the liquibase parent repository (not just the liquibase-core module) as follows:

    <dependency>
        <groupId>com.github.liquibase</groupId>
        <artifactId>liquibase</artifactId>
        <version>f7f3b8f60b</version>
    </dependency>
    

    Which also errors out. According to JitPack's log for this commit, it looks like there is a compilation error with the source:

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project liquibase-core: Compilation failure

    [ERROR] /home/jitpack/build/liquibase-core/src/main/java/liquibase/parser/core/formattedsql/FormattedSqlChangeLogParser. java:[213,209] ')' expected

    It seems like the best route would be to file an issue with the JitPack folks and see if they can shed some light on it.