Hello, Context: I have project which produce multi...
# community-support
p
Hello, Context: I have project which produce multiple jar and finally a jar with a mainClass, I use the application plugin to install it locally and test it. I publish all this jar on a maven repository. My interrogation: What is the "standard" gradle way for another project to get the equivalent of the result of the application plugin(all jar in a single place and a script to launch it)? I see that I can publish the zip distribution(https://docs.gradle.org/current/userguide/distribution_plugin.html#ex-adding-distribution-archives-to-a-maven-publication) but it's mean duplicate all the jar on your maven repo and I don't know how to tell gradle to download and install it after. Thanks for reading me and sorry for the poor English level.
v
Your English is fine as far as I can tell as non-native speaker. The "equivalent" would be to do the same, apply the
application
plugin so that the consuming build assembles the application accordingly. If you publish the whole distribution archive, you would either use an artifact transform to unarchive it, or have a
Sync
task or
sync { ... }
call to unarchive it to some directory and then execute from there.
p
For more context I try to retrieve my application on a CI/CD to run Integration test level. I add the
application
to a minimal build.gradle with a dependency to the 'Main' jar like that
runtimeOnly (group: 'com.company', name: "webserver", version: 1.0.0)
all jar are correctly installed in build/install/my_project/lib but the application plugin try to run the empty jar produced by me empty project 😅
v
Yes, you need to set the main class on your "minimal" project
The main class within a jar is only relevant if you run it with
-jar
which Gradle would do if there were only one jar in the classpath which is not the case as you have dependencies