Question

enter image description here

I have a common service which is packaged as a jar with all it's dependencies.

Consumer1, consumer2, consumer3 provides different configuration for Common_service. What is the best way to repackage common_service with all it's jar content and in addition, bundle the configuration with it.

Final output, on Consumer1 would give :

  • Consumer1-shaded.jar (without common-service)
  • Consumer1-Common-service.jar (only common-service with custom configuration)

Consumer2 would give :

  • Consumer2-shaded.jar (without common-service)
  • Consumer2-Common-service.jar (only common-service with custom configuration)

I tried maven shade to repackage common_service, but I need to explicitly include all the dependencies of common service in consumer., Why should the consumer be aware of the common service contents ? Is there any direct way to take the jar, add config and repackage ?

Was it helpful?

Solution

To get what you want, probably your best bet is to have four maven modules. The common_service module would no longer produce a shaded jar, just a regular jar. The consumer_1 module would include the configuration files and have common_service as a dependency, and would produce a shaded jar. The consumer_2 and consumer_3 modules would be set up similar to the consumer_1 module.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top