Search code examples
javamavenpom.xmlmaven-pluginmaven-dependency

whats the use of the dependencies in the plugin element on a pom.xml


I've see you can add dependencies element of the plugin element in a pom.

Question: What's for? Should'nt all the lib used by a plugin be include inside it? Do it surcharge some lib used by the plugin?

<plugin>
    <groupId>org.raml.plugins</groupId>
    <artifactId>raml-jaxrs-maven-plugin</artifactId>
    <version>1.3.4</version>
    <dependencies>
        <dependency>
            <groupId>org.raml</groupId>
            <artifactId>raml-parser-2</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
</plugin>

Solution

  • Dependency in plugin element allows you to define a specific version you will like the plugin to use.

    Here is a good example on maven.apache.org

    For instance, the Maven Antrun Plugin version 1.2 uses Ant version 1.6.5, if you want to use the latest Ant version when running this plugin, you need to add <dependencies> element