Leaves One

Alan Richard's Blog

Publish Package on JitPack with Java 16 - Solving “No Artifacts Found” Problem

JitPack

JitPack is an easy to use package repository for Git. I use it to publish my Minecraft plugins as package so that other developers can add them to their projects as dependencies.

Problem

Since Minecraft 1.17 release, Java 16 is required to run the game as well as the server. I have begun building my plugins with Java 16 from then on.

Nevertheless, JDK 16 is not supported by JitPack, hence build may fail.

The JDK 16 environment can be easily solved following the discussion in this link: https://github.com/jitpack/jitpack.io/issues/4355#issuecomment-744678253. However, ERROR: No build artifacts found would still be thrown even if you have done all the steps mentioned in the discussion.

By searching through the issues, we can see that there are a great amount of similar complains in https://github.com/jitpack/jitpack.io/issues.

Issues

And there are even a few people suggests that JitPack “does not support JDK 16”.

Solving “ERROR: No build artifacts found”

Put ensure-java-16 and jitpack.yml in the root of your repo.

ensure-java-16 for JDK 16 support.

#!/bin/bash

JV=`java -version 2>&1 >/dev/null | head -1`
echo $JV | sed -E 's/^.*version "([^".]*)\.[^"]*".*$/\1/'

if [ "$JV" != 16 ]; then
case "$1" in
install)
echo "Installing SDKMAN..."
curl -s "https://get.sdkman.io" | bash
source ~/.sdkman/bin/sdkman-init.sh
sdk version
sdk install java 16.0.2-open
;;
use)
echo "must source ~/.sdkman/bin/sdkman-init.sh"
exit 1
;;
esac
fi

Edited version of jitpack.yml

jdk:
- openjdk16
before_install:
- echo "Before Install"
- bash ensure-java-16 install
install:
- echo "Install"
- if ! bash ensure-java-16 use; then source ~/.sdkman/bin/sdkman-init.sh; fi
- java -version
- mvn install

Notice

We use bash ensure-java-16 install in the jitpack.yml instead of solely ensure-java-16 install because the later would raise No permission when building.

And finally, - mvn install at the end of jitpack.yml is the key to solve “ERROR: No build artifacts found” issue.

Result

Successfully Build