Good morning, I have a multi-project build, one mo...
# community-support
d
Good morning, I have a multi-project build, one module being a Spring Boot War project with produced
.class
files. We have another module that currently consumes a
jar
that has these classes (non-Spring Boot ones, our implementation). We'd like to remove the need to create a jar for the war project's classes and share the output from that module a different way. I was thinking a fileTree reference to the output classes directory might be a way of doing it, but if there's a better way of doing this, I think I'm overlooking it. What is the best way of going about this? I read up on sharing outputs from projects by creating a consumable configuration but I think that would be sharing a .jar or a .war. Sharing a .war would be okay, but from my understanding, I don't think you can depend on a .war.
For more context, we want to maintain a separate module for testing the war's classes under Spring Boot. Both projects utilize Spring Boot today, but we might be able to make the war with our class implementations a regular war in the long-term and remove Spring Boot dependencies from that project.
a
It sounds like you should split up the Spring Boot War project into two projects - a Java library (with the files that you want to use in the Spring Boot War and also the other module), and the actual Spring Boot War project.
the Java Library plugin shares files as classes instead of Jars https://docs.gradle.org/8.7/userguide/java_library_plugin.html#sec:java_library_classes_usage
Does that sound like it would work for you?
d
We could do that... but I don't think we want any jar being produced from this since we named it
{projectname}-war
, as an org standard we have in place (in most places not all). I agree with that approach in general, but for our situation I think it's going to cause more confusion
The better practice might be to rename the project so it doesn't look like we're dependent on a produced
war
file. There isn't currently a case where the
jar
being produced would be consumed by any other external project outside of this repo.