This message was deleted.
# community-support
s
This message was deleted.
1
t
The "proper" way to access things from other projects is to have them expose them as artifact attached to variants: https://docs.gradle.org/current/userguide/cross_project_publications.html#sec:variant-aware-sharing Fwiw,
sourceSets.main.output
and
configurations.runtimeClasspath
are already exposed as the
runtimeElements
of Java projects, so declare a configuration and add those target projects as dependencies to that configuration and it should "just work".
From your snippet, it's hard to understand what you actually want into your JAR.
(fwiw, your problem here is probably due to the
runtimeClasspath.get().files
that resolves the configuration too early)
v
I'd say he wants a bad-practice fat jar with all projects output and all dependencies crammed inside. I strongly recommend you not do that, but instead build a proper distribution using the
application
plugin. See https://fatjar.net for some quotes on why it is a bad idea. If you really need to follow that road, at least us the
shadow
plugin of John Engelman which mitigates at least some of the problems you get from trying this.
u
@Thomas Broyer Actually, I just want create
jar
artifacts so previous method I use
intellij
to create
jar
but I need to convert to create by command line for use in CI. As I know to add from compare with previous method. • all main of subproject • kapt because I use some generate lib to create fule • all dependencies each use in subproject
@Vampire Regrading
shadow
are you mean this way?
Copy code
plugins {
    alias(libs.plugins.shadow)
}
Copy code
shadowJar {

}
v
My recommendation stands. Do not even try, but simply use the
application
plugin to build a proper distribution and save you a lot of headache.
But maybe I meant that, I cannot guess what you have in your version catalog 😉
u
Sorry,
com.github.johnrengelman.shadow
I can't use normal way to build app because I need to create
jar
for mod game and that game to call function in my
jar
file 😭
v
Yeah, then at least use that plugin
🙏 1