But at startup, only compiling jar classes is not created and everything fails.
You really can configure the maven-war plugin to package / deploy the classes and resources included in your webapp as a “sticky” JAR artifact with a classifier with the following configuration:
<project> ... <artifactId>mywebapp</artifactId> <version>1.0-SNAPSHOT</version> ... <build> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <version>XY</version> <configuration> <attachClasses>true</attachClasses> </configuration> </plugin> </plugins> </build> ... </project>
But this artifact is created during the package phase, so don't expect it to be there if you only run compile .
Please note that this configuration option was introduced for a very specific use case, a skinny military use case. If you need to reuse this JAR in another project, it is recommended that you use the general approach to move the classes to a separate module that creates the JAR, and then declare a dependency on this JAR on your webapp, as well as on any other projects that need it.
Pascal thivent
source share