I am creating a library (jar) to be consumed by different java applications.
Both need to be able to serialize. So I do need the com.google.flatbuffers:flatbuffers-java dependency in both projects to access FlatBufferBuilder.
So my library project is not using the java gradle plugin instead it uses java-library and maven-publish as plugins. The generated pom contains the dependency but not as compile dependency but as runtime.
<dependencies>
<dependency>
<groupId>com.google.flatbuffers</groupId>
<artifactId>flatbuffers-java</artifactId>
<version>2.0.2</version>
<scope>runtime</scope>
</dependency>
</dependencies>
This basically means I need to pull in flattbuffers-java my self or expose it manually by adding it via
api("com.google.flatbuffers:flatbuffers-java:...") where I need to duplicate the version number flatBuffersVersion (i.e. using version catalogs or variables) but especially I duplicate the dependency definition itself.
I would like to see this plugin detecting the java-library plugin and replacing the implicit implementation dependency definition with an api definition.
Alternatively a switch to control the dependency definition would be nice and would allow usage in some other scenarios, i.e. compileOnly.
I am creating a library (jar) to be consumed by different java applications.
Both need to be able to serialize. So I do need the
com.google.flatbuffers:flatbuffers-javadependency in both projects to accessFlatBufferBuilder.So my library project is not using the
javagradle plugin instead it usesjava-libraryandmaven-publishas plugins. The generated pom contains the dependency but not as compile dependency but as runtime.This basically means I need to pull in
flattbuffers-javamy self or expose it manually by adding it viaapi("com.google.flatbuffers:flatbuffers-java:...")where I need to duplicate the version numberflatBuffersVersion(i.e. using version catalogs or variables) but especially I duplicate the dependency definition itself.I would like to see this plugin detecting the
java-libraryplugin and replacing the implicitimplementationdependency definition with anapidefinition.Alternatively a switch to control the dependency definition would be nice and would allow usage in some other scenarios, i.e.
compileOnly.