Home > OS >  How to configure a Maven project to generate a different jar for each implementation of an interface
How to configure a Maven project to generate a different jar for each implementation of an interface

Time:06-29

I have to build a small Springboot application where the Controller class uses an interface. The interface is implemented by four different classes. These four implementations represent four different platforms the application will run in and have dependencies based on the different platforms they run on. In any one platform, only one of the implementations will be used.

Therefore, I want to be able to package the application as four separate jars, each of which contains one implementation (so I can deploy the app based on the platform with only one implementation). I have no idea how to get this working. Any help is appreciated. Any hints on how I would have the folder structure of the project as well would help a lot too.

CodePudding user response:

Use a multi-module project, with one common module and four modules for the different implementations.

  • Related