I'm using Jib to Containerize the output of some Gradle Jar tasks. This works fine for default Jar task. My issue is we have a custom Jar task hooked into our build process e.g.
tasks.register('myOtherJarTask',jar){
//do stuff, triggered by assemble task
// outputted to non default directory
}
and I want the output of this to be containerized not the default Jar, The default Jar is also still valid for us for other reasons. Is there a way to allow for this in JIB, from looking at the source code of the JIB plugin it seems it coded to expect the output of the Jar task. Code from Jib plugin:
Jar jarTask = (Jar) project.getTasks().findByName("jar");
Path jarPath = jarTask.getArchiveFile().get().getAsFile().toPath();
log(LogEvent.debug("Using JAR: " + jarPath));
javaContainerBuilder.addToClasspath(jarPath);
I also tried Copying the jar from 'myOtherJarTask' into the container using extraDirectories property and executing that way via a entrypoint but the default Jar does not contain a main class so that blocks this (myOtherJarTask has a main class). restructuring the project so the defaut Jar produces my desired output is not a option.
Maybe there is another way that is not clear to me.
Any help appreciated.