In my application built by Maven I have two platform-specific dependencies that are mutually exclusive. During the project's build I would like to build two runnable jars where one jar contains one dependency and the second jar contains the other dependency.
My first thought was to create two build profiles where each one contains one of the dependencies and the Maven Assembly or Shade plugin to build a runnable jar. Unfortunately that does not seem to work because only one of the jars will build. I tried enabling both on the command line (-Pprofile1,profile2
), setting both activeByDefault
to true
but still no luck.
Before I try to work around it by creating two project submodules to do the builds, is there a way to build two runnable jars with different dependencies in the same Maven project?