Project 1: a Java/Maven project
Project 2: a Scala/sbt project
Thing: generally, an immutable object instantiated in from 3rd party Java library. For example, ThingBuilder.foo("bar").build()
Question: How can I define Thing in only one place, and have it used both in Project 1 and 2? (So the parameters in ThingBuilder are guaranteed to be the same in both projects.)
1 Answer 1
One way would be to create a library wrapping the creation of the immutable object, and have it's creation driven by a shared config file.
lightbend's config is useful for this because it's implemented in Java, despite being a lightbend project.
Thing
object with a certain state and the other did not but wants to use it in that state. Or if you just want to be able to defineThing
with a java class in the java project but create it as an object in your scala project where you would give it state and not share that object with the java/maven project.