mavenversions-maven-plugin

Does versions-maven-plugin requires artifacts to be defined in depency as well


i have a maven project where i am using versions-maven-plugin to ensure that for few artifacts only the latest version will be used. These artifacts are included via <include>....</include> tag.

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>update-versions</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>use-latest-versions</goal>
                        </goals>
                    </execution>
                </executions>
                <!-- add your Mosaiq dependencies here to stay up to date -->
                <configuration>
                    <includes>
                        <include>mygroupid:myartifactid</include>
                    </includes>
                </configuration>
            </plugin>

My question is do i need to mention above artifact in <dependency>..</dependency> as well or versions-maven-plugin will automatically take care of that and will download the latest version.


Solution

  • Yes, you have to add them as a dependency first.

    The task versions-maven-plugin:use-latest-versions will update the versions of existing dependencies only.

    There are no maven plugins that magically add dependencies AFAIK.