Let's say I have two microservices (S1 and S2), each one under a Maven module, both inheriting from the parent pom . As you can see, these services have a swarm profile that uses the swarm plugin . These two profiles being identical, I wanted to move it to the parent pom . Unfortunately when I do that (mvn clean install -Pswarm), I get the following exception :
ERROR] Failed to execute goal org.wildfly.swarm:wildfly-swarm-plugin:2017.2.0:package (package) on project parent: Cannot package without a primary artifact; please `mvn package` prior to invoking wildfly-swarm:package from the command-line
That's the Swarm plugin not being happy about not having a war file to package.
It would make sense to avoid this check when the packaging is pom (<packaging>pom</packaging>). This way we could aggregate this kind of profile in the parent pom that would only act on the child modules.