------ Configuring the Classpath ------ Pascal Lambert ------ 2010-01-09 ------ ~~ Licensed to the Apache Software Foundation (ASF) under one ~~ or more contributor license agreements. See the NOTICE file ~~ distributed with this work for additional information ~~ regarding copyright ownership. The ASF licenses this file ~~ to you under the Apache License, Version 2.0 (the ~~ "License"); you may not use this file except in compliance ~~ with the License. You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, ~~ software distributed under the License is distributed on an ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~~ KIND, either express or implied. See the License for the ~~ specific language governing permissions and limitations ~~ under the License. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html The Default Classpath The surefire plugin builds the test classpath in the following order: #{if}(${project.artifactId}=="maven-surefire-plugin") [[1]] The {{{../test-mojo.html#testClassesDirectory}test-classes}} directory [[2]] The {{{../test-mojo.html#classesDirectory}classes}} directory #{else} [[1]] The {{{../integration-test-mojo.html#testClassesDirectory}test-classes}} directory [[2]] The {{{../integration-test-mojo.html#classesDirectory}classes}} directory #{end} [[3]] The project dependencies [[4]] Additional classpath elements Additional Classpath Elements If you need to put more stuff in your classpath when ${thisPlugin} executes (e.g some funky resources or a container specific JAR), we normally recommend you add it to your classpath as a dependency. Consider deploying shared jars to a private remote repository for your organization. But, if you must, you can use the <<>> element to add custom resources/jars to your classpath. This will be treated as an absolute file system path, so you may want use $\{basedir\} or another property combined with a relative path. Note that additional classpath elements are added to the end of the classpath, so you cannot use these to override project dependencies or resources. +---+ [...] ${project.groupId} ${project.artifactId} ${project.version} path/to/additional/resources path/to/additional/jar [...] +---+ Removing Dependency Classpath Elements Dependencies can be removed from the test classpath using the parameters <<>> and <<>>. A list of specific dependencies can be removed from the classpath by specifying the groupId:artifactId to be removed. +---+ [...] ${project.groupId} ${project.artifactId} ${project.version} org.apache.commons:commons-email [...] +---+ Dependencies under a certain scope can be removed from the classpath using <<>>. The valid values for the dependency scope exclude are defined by <<>>. * <> - system, provided, compile * <> - compile, runtime * <> - system, provided, compile, runtime, test +---+ [...] ${project.groupId} ${project.artifactId} ${project.version} runtime [...] +---+