I have a sprint-boot project "A" which has a main class which extends SpringBootServletInitializer so that war can be deployed for the same. This library/module is also a dependent library for another project "B" which has its own main class. In A's pom.xml, i have added the following in pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>copyLib</warName>
<attachClasses>true</attachClasses>
<classesClassifier>classes</classesClassifier>
<packagingExcludes>
WEB-INF/lib/tomcat-*.jar,
WEB-INF/lib/jetty-*.jar,
WEB-INF/lib/websocket-*.jar,
WEB-INF/lib/jakarta.websocket*.jar,
WEB-INF/lib/javax-websocket*.jar,
WEB-INF/lib/snakeyaml*.jar
</packagingExcludes>
</configuration>
</plugin>
With the above plugin both war & jar is getting created.
Now what i want is main class of A does not get included in jar but should get added in war so that when same jar is used by B, main class does not get invoked. I tried many approaches but failed. I even tried using @Profile but that also does not work