crylent
crylent

Reputation: 21

Jitpack builds successfully, but there is no jar file or jar doesn't contain .class files

I'm trying to build my Android library with Jitpack, but it doesn't make any jar file, so I can insert implementation 'com.github.crylent:midilib:fbcf4f6c1e' into a gradle file in another project and successfully sync it, but can't import any classes from the library and even don't see the library in the External Libraries list.

In build log:

✅ Build artifacts:
com.github.crylent:midilib:b848154487

Files: 
com/github/crylent/midilib/b848154487
com/github/crylent/midilib/b848154487/build.log
com/github/crylent/midilib/b848154487/midilib-b848154487-sources.jar
com/github/crylent/midilib/b848154487/midilib-b848154487.pom
com/github/crylent/midilib/b848154487/midilib-b848154487.pom.md5
com/github/crylent/midilib/b848154487/midilib-b848154487.pom.sha1

Full Log

jitpack.yml:

before_install:
  - yes | sdkmanager "cmake;3.22.1"
  - sdk update
  - sdk install java 17.0.1-zulu
  - sdk use java 17.0.1-zulu

pom.xml:

<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.crylent</groupId>
    <artifactId>midilib</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
    </properties>

    <build>

        <plugins>

            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.3.1</version>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.3.1</version>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.1.0</version>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <classesDirectory>src</classesDirectory>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-install-plugin</artifactId>
                <version>3.1.1</version>
            </plugin>
            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>3.1.1</version>
            </plugin>
            <plugin>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.12.1</version>
            </plugin>
            <plugin>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>3.4.4</version>
            </plugin>
        </plugins>
    </build>

</project>

build.gradle

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.1.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
    }
}

plugins {
    id 'com.android.library' version '7.3.0' apply true
    id 'org.jetbrains.kotlin.android' version '1.8.21' apply true
    id 'maven-publish' apply true
}

android {
    publishing {
        singleVariant('release') {
            withSourcesJar()
            withJavadocJar()
        }
    }
}

afterEvaluate {
    publishing {
        publications {
            release(MavenPublication) {
                components.getByName('release')

                groupId = 'com.crylent'
                artifactId = 'midilib'
                version = 'v1.0'
            }
        }
    }
}

android {
    namespace 'com.crylent.midilib'
    compileSdkVersion 33

    defaultConfig {
        minSdk 24
        targetSdk 33

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles "consumer-rules.pro"
        externalNativeBuild {
            cmake {
                cppFlags "-std=c++20 -fexceptions"
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            jniDebuggable true
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = '17'
    }
    externalNativeBuild {
        cmake {
            path file('src/main/cpp/CMakeLists.txt')
            version '3.22.1'
        }
    }
    ndkVersion '25.2.9519653'
}

dependencies {

    api 'androidx.core:core-ktx:1.10.1'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

    api 'com.google.oboe:oboe:1.7.0'

}
install:
  - mvn install

When I add this to jitpack.yml, I get another Build Log. Jar exists, but I still can't import classes from the library into another project. When I download jar and decompile it, I see uncompiled .kt files instead of .class that I expect to see, as they are in other libraries.

Upvotes: 2

Views: 180

Answers (0)

Related Questions