How can I view transitive dependencies of a Maven pom.xml file?

On the CLI, use mvn dependency:tree (Here are some additional Usage notes) When running dependency:tree on multi-module maven project, use mvn compile dependency:tree instead1. Otherwise, the POM Editor in M2Eclipse (Maven integration for Eclipse) is very good, and it includes a hierarchical dependency view. 1If you don’t compile, you might get error Failed to execute … Read more

How to keep Maven profiles which are activeByDefault active even if another profile gets activated?

One trick is to avoid activeByDefault, and instead activate the profile by the absence of a property, eg: <profiles> <profile> <id>firstProfile</id> <activation> <property> <name>!skipFirstProfile</name> </property> </activation> … </profile> </profiles> You should then be able to deactivate the profile with -DskipFirstProfile or with -P !firstProfile, but otherwise the profile will be active. See: Maven: The Complete … Read more

maven-assembly-plugin doesn’t add dependencies with system scope

you can do it by adding this dependencySet to your assembly file descriptor <dependencySet> <outputDirectory>/</outputDirectory> <unpack>true</unpack> <scope>system</scope> </dependencySet> this assembly descriptor add all dependencies including system scoped <assembly xmlns=”″ xmlns:xsi=”” xsi:schemaLocation=””> <id>jar-with-all-dependencies</id> <formats> <format>jar</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <dependencySets> <dependencySet> <outputDirectory>/</outputDirectory> <useProjectArtifact>true</useProjectArtifact> <unpack>true</unpack> <scope>runtime</scope> </dependencySet> <dependencySet> <outputDirectory>/</outputDirectory> <unpack>true</unpack> <scope>system</scope> </dependencySet> </dependencySets> </assembly>

Share test resources between maven projects

Just use jar:test-jar and declare the resulting JAR as a dependency (refer to this guide for more details). And while I don’t understand the problem of having resources and classes in this jar, you can always exclude all .class files: <project> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.2</version> <executions> <execution> <goals> <goal>test-jar</goal> </goals> </execution> </executions> <configuration> … Read more

Use public maven repository with ivy

You need to add an ivysettings.xml file with the following repositories listed (resolvers in ivy speak) <ivysettings> <settings defaultResolver=”chain”/> <resolvers> <chain name=”chain”> <ibiblio name=”central” m2compatible=”true”/> <ibiblio name=”example” m2compatible=”true” root=””/> </chain> </resolvers> </ivysettings> In my opinion it makes more sense to separate the dependency declaration (ivy.xml) from the mechanism of retrieval (settings.xml). This is not needed … Read more