Exclude maven dependency for tests

You could (re)configure the classpath during the test phase thanks to the maven surefire plugin. You can add classpath elements or exclude dependencies. <project> […] <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.12.2</version> <configuration> <additionalClasspathElements> <additionalClasspathElement>path/to/additional/resources</additionalClasspathElement> <additionalClasspathElement>path/to/additional/jar</additionalClasspathElement> </additionalClasspathElements> <classpathDependencyExcludes> <classpathDependencyExclude>org.apache.commons:commons-email</classpathDependencyExclude> </classpathDependencyExcludes> </configuration> </plugin> </plugins> </build> […] </project> As noted by @jFrenetic you could do the same with … Read more

What are all of the Maven Command Line Options?

Found this page today. Maven CLI Options Reference. Text version to make it easy to copy/paste Maven CLI Options Reference Options >> Description -am,–also-make >> If project list is specified, also build projects required by the list -amd,–also-make-dependents >> If project list is specified, also build projects that depend on projects on the list -B,–batch-mode … Read more

Plugins in Maven and POM.xml

<project> <groupId>org.koshik.javabrains</groupId> <artifactId>JarName</artifactId> (A fldernamed JarName was created) <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>JarName</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <plugin> <groupId>org.jibx</groupId> <artifactId>jibx-maven-plugin</artifactId> <version>1.2.4</version> <executions> <execution> <goals> <goal>bind</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project> You can also place plugins in the <build> section of <profile> if you use maven … Read more

Unable to locate Source XRef to link to

You should add the maven-jxr-plugin to the reportingPlugin section. <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jxr-plugin</artifactId> <version>3.3.0</version> </plugin> </plugins> </reporting> Re run it and enjoy. BTW, maybe you’ll need to run once the jxr:jxr goal to first generate some file that will be used by pmd.