Everything in Maven revolves around plugins. Plugins are programs that perform some kind of behavior during the build process. Some plugin inclusions are implied without having to declare anything.
These implied ones have default configurations. For example, maven-compiler-plugin included in all projects without announcing it. To override the default configurations, we need to declare the plugin in the pom.xml file and set the configurations. For example, you will see that many projects override the default value for maven-compiler-plugin , in which it has source and target installed on Java 1.5. We can change to 1.8
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build>
This is just the theory behind plugins to give you an idea of โโwhat's going on.
With that said, to use <packaging>war<packaging> , the maven-war-plugin used without having to declare anything. In the same way as using <packaging>jar</packaging> , the inclusion of maven-jar-plugin implied.
The default configuration for maven-war-plugin is an error in which there is no web.xml (this is a failOnMissingWebXml configuration failOnMissingWebXml ). Therefore, if we want to override this default value, we need to declare the plugin and then set the property to false (does not work)
<build> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> </plugins> </build>
source share