문제

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 ?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top