Tag Archives: artifacts

jitpack.io ERROR: No build artifacts found [How to Solve]

jitpack.io ERROR: No build artifacts found

The foreword is solved

preface

Before, Android studio has been used to develop open source libraries and put them into jitpack Compile and package on Io. Recently, due to the research on the kotlin multiplatform of JetBrains, it is changed to develop an independent JVM library or multiplatform Library in idea. The multiplatform library is placed in jitpack There are bound to be problems with IO, because jitpack There are only JVM environments on Io. However, when the JVM library is put on, there are compilation success and packaging errors, error: no build artifacts found

Solution:

This is actually due to the fact that the com.android.libraryplugin is included when developing the library in Android studio, and artifacts are generated. But there is no need to put the com.android.libraryplugin in when making the jvm library ;

So we need to add artifacts manually.

Modify build Gradle file
groovy:

publishing {
    publications {
    	// This mavenJava can be filled in randomly, it's just a task name
    	// MavenPublication must have, this is the task class to call
        mavenJava(MavenPublication) {
        	// The header here is the artifacts configuration information, do not fill in the default
            groupId = 'org.gradle.sample'
            artifactId = 'library'
            version = '1.1'

            from components.java
        }
    }
}

If it is build gradle.kts file
kotlin:

publishing {
    publications {
        create("maven_public", MavenPublication::class) {
            groupId = "org.gradle.sample"
            artifactId = "library"
            version = "1.1"
            from(components.getByName("java"))
        }
    }
}

Finish