I just started using Maven and I read that plugins are additional components that can be used.
A typical structure of pom.xml
file is
<project> <groupId>org.koshik.javabrains</groupId> <artifactId>JarName</artifactId> (A fldernamed JarName was created) <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>JarName</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project>
Question: Where should I insert a plugin
tag? such as the following:
<plugin> <groupId>org.jibx</groupId> <artifactId>jibx-maven-plugin</artifactId> <version>1.2.4</version> <executions> <execution> <goals> <goal>bind</goal> </goals> </execution> </executions> </plugin>
Before the dependency or after the dependency
tag? Does it matter?
From Maven documentation: pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except that rather than configuring plugin information for this particular project build, it is intended to configure project builds that inherit from this one.
In Maven, there are two kinds of plugins, build and reporting: Build plugins are executed during the build and configured in the <build/> element. Reporting plugins are executed during the site generation and configured in the <reporting/> element.
<project> <groupId>org.koshik.javabrains</groupId> <artifactId>JarName</artifactId> (A fldernamed JarName was created) <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>JarName</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <plugin> <groupId>org.jibx</groupId> <artifactId>jibx-maven-plugin</artifactId> <version>1.2.4</version> <executions> <execution> <goals> <goal>bind</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project>
You can also place plugins in the <build>
section of <profile>
if you use maven profiles. The order doesn't matter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With