How to get access to Maven’s dependency hierarchy within a plugin

The dependency plugin has the tree goal that does most of this work. It processes a MavenProject using the DependencyTreeBuilder, this returns a DependencyNode with hierarchical information about the resolved dependencies (and their transitive dependencies). You can copy much of the code directly from the TreeMojo. It uses the CollectingDependencyNodeVisitor to traverse the tree and … Read more

Force re-download of release dependency using Maven

You cannot make Maven re-download dependencies, but what you can do instead is to purge dependencies that were incorrectly downloaded using mvn dependency:purge-local-repository See: http://maven.apache.org/plugins/maven-dependency-plugin/purge-local-repository-mojo.html This looks up the list of all transitive dependencies of the current project, deletes them, then redownloads them. You can even add it as a plugin into your pom if … Read more

Eclipse : Maven search dependencies doesn’t work

Eclipse artifact searching depends on repository’s index file. It seems you did not download the index file. Go to Window -> Prefrences -> Maven and check “Download repository index updates on start”. Restart Eclipse and then look at the progress view. An index file should be downloading. After downloading completely, artifact searching will be ready … Read more

Maven WAR dependency

There’s another option since maven-war-plugin 2.1-alpha-2. In your WAR project: <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <attachClasses>true</attachClasses> </configuration> </plugin> This creates a classes artifact which you can use in the acceptance tests project with: <dependency> <groupId>your-group-id</groupId> <artifactId>your-artifact-id</artifactId> <version>your-version</version> <classifier>classes</classifier> </dependency>

What is pluginManagement in Maven’s pom.xml?

You still need to add <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> </plugin> </plugins> in your build, because pluginManagement is only a way to share the same plugin configuration across all your project modules. From Maven documentation: pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except … Read more