I have a multi-project structure managed with gradle. All the java sub-projects have this jar
block:
def main_class = "foo.Main"
jar {
manifest {
attributes 'Main-Class': main_class
}
}
So I decided that I'm going to move the jar block to the root project and have only the def main_class
in the sub-projects, but no matter how I defined the main_class
variable, it didn't work. I tried project.ext
and properties {}
as well.
I had a task, called dist
which worked with project.ext
:
root project:
subprojects {
task dist(dependsOn: jar) << {
copy {
from('build/libs') {
include (build_jar)
}
into('.')
rename(build_jar, app_jar)
}
}
}
a sub-project:
project.ext {
build_jar = "..."
app_jar = "..."
}
How can I define a variable that works with jar
like with the dist
task?