I am trying to publish an android library to jitpa...
# community-support
t
I am trying to publish an android library to jitpack but the build keeps failing on jitpack:
Copy code
Looking for pom.xml in build directory and ~/.m2
Found artifact: com.github.tanish-ranjan:jetpack_compose_components:1.0.0
Found artifact: Compose Components:jetpack_compose_components:unspecified
Found artifact: com.github.tanish-ranjan:jetpack_compose_components:1.0.0
2024-07-05T18:29:27.588745741Z
Exit code: 0

āš ļø ERROR: No build artifacts found
Expected artifacts in: $HOME/.m2/repository/com/github/tanish-ranjan/jetpack_compose_components/1.0.0
v
You need to scroll up a bit more, then you see the actual problem.
releaseSourcesJar
uses an output of
copyAar
without inputs and outputs wired properly, so the build failed. Besides that, I highly recommend you do not use JitPack for normal publishing. It is somewhat ok for testing snapshots of branches or commits if no snapshot builds are published, but it is slow, unreliable, buggy, and conceptually broken for normal releases. Imho if you want to publish, you should do so properly to Maven Central. šŸ™‚
ā˜ļø 1
The problem of the build actually is just the
copyAar
task. It is a
Copy
task with destination dir
projectDir
, so everything in
projectDir
is considered an output of that task and so any task that uses any file as input will trigger that error. Instead use an "untyped" task, define the input file and output file explicitly via
outputs.file
and
inputs.file
and use a
copy { ... }
block within
doLast { ... }
instead, then the
copyAar
task works the same but has only that explicit file as output.
t
This is my first time publishing a library actually. And I did start with Maven Central, but couldn't find much resources for publishing android libraries to maven central. Most of the ones I found were also outdated. I will try the fixing the
copyAar
task as you said. If it doesn't work then I will give maven central another go.
t
Thank you!
šŸ‘Œ 1