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