I've been trying to use Maven to build a project. The project builds fine on a few computers I tried but on one machine, I'm having a random issue.
Essentially, maven is searching for a dependency that is not included in the pom.xml file or the in the settings.xml file at all.
I have tried mvn dependency:purge-local-repository but still no avail; I'm still stuck at mvn searching for a dependency I have no idea where it's looking from.
If you run mvn dependency:tree on your project you'll see where the unwanted dependency is being introduced, you can then exclude the dependency.
This is an example of the output:
[INFO] [dependency:tree]
[INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT
[INFO] \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile
[INFO] \- org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile
[INFO] \- velocity:velocity:jar:1.4:compile
To exclude a dependency, you'd do something like this:
<dependency>
<groupId>sample.ProjectA</groupId>
<artifactId>Project-A</artifactId>
<version>1.0</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>sample.ProjectB</groupId>
<artifactId>Project-B</artifactId>
</exclusion>
</exclusions>
</dependency>
For more details on the dependency plugin see the documentation.
For more details on exclusions, see the guide.
Update: You can also use the m2eclipse plugin to generate a graphical tree of the dependencies or as a graph. dependency tree screenshot http://www.sonatype.com/books/m2eclipse-book/reference/figs/web/eclipse_pom-editor-depend-tree-locate.png dependency graph screenshot http://www.sonatype.com/books/m2eclipse-book/reference/figs/web/eclipse_pom-editor-graph.png
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