In a multi-project project, how do I include all the code/jar from project A in the assembled jar for project B when project B depends on project A? Does that make sense?
Thanks, Andy
In a multi-project project, how do I include all the code/jar from project A in the assembled jar for project B when project B depends on project A? Does that make sense?
Thanks, Andy
Why do you want to do this? And do you mean
having all A’s classes merged into B’s jar file, or
include A’s jar file inside B’s jar file
There is a Gradle plugin for 2. that includes all of B’s dependencies inside its jar file so you can just run it like this:
java -jar b.jar
You can find this plugin at the Github project gradle-executable-jar-plugin with a description on how to use it.
Basically I have a strict java library and I have a groovy project that adds some groovyness to the java lib. I would prefer that when I package the groovy project it would just include all the java code.
Thanks, Andy
Here is one way:
B/build.gradle:
jar {
from { project(":A").compileJava }
from { project(":A").processResources }
}