~ubuntu-branches/ubuntu/precise/surefire/precise

« back to all changes in this revision

Viewing changes to maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm

  • Committer: Bazaar Package Importer
  • Author(s): Miguel Landaeta
  • Date: 2011-10-10 20:42:16 UTC
  • mfrom: (2.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20111010204216-cemva69wkagf4fay
Tags: 2.10-1
* Team upload.
* New upstream release.
* Refresh and remove unneccesary patches.
* Add Build-Depends on libsurefire-java and
  libmaven-common-artifact-filters-java.
* Drop outdated Maven artifact surefire-junit.
* Provide new Maven artifacts: surefire-junit3, maven-surefire-common,
  common-junit3, common-junit4, surefire-junit47 and surefire-testng-utils.
* Fix clean target to allow "two in a row" builds.
* Update Vcs-Browser field.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
  ------
 
2
  Configuring the Classpath
 
3
  ------
 
4
  Pascal Lambert
 
5
  ------
 
6
  2010-01-09
 
7
  ------
 
8
  
 
9
 ~~ Licensed to the Apache Software Foundation (ASF) under one
 
10
 ~~ or more contributor license agreements.  See the NOTICE file
 
11
 ~~ distributed with this work for additional information
 
12
 ~~ regarding copyright ownership.  The ASF licenses this file
 
13
 ~~ to you under the Apache License, Version 2.0 (the
 
14
 ~~ "License"); you may not use this file except in compliance
 
15
 ~~ with the License.  You may obtain a copy of the License at
 
16
 ~~
 
17
 ~~   http://www.apache.org/licenses/LICENSE-2.0
 
18
 ~~
 
19
 ~~ Unless required by applicable law or agreed to in writing,
 
20
 ~~ software distributed under the License is distributed on an
 
21
 ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 
22
 ~~ KIND, either express or implied.  See the License for the
 
23
 ~~ specific language governing permissions and limitations
 
24
 ~~ under the License.
 
25
 
 
26
 ~~ NOTE: For help with the syntax of this file, see:
 
27
 ~~ http://maven.apache.org/doxia/references/apt-format.html
 
28
 
 
29
The Default Classpath
 
30
 
 
31
  The surefire plugin builds the test classpath in the following order:
 
32
 
 
33
#{if}(${project.artifactId}=="maven-surefire-plugin")
 
34
  [[1]] The {{{../test-mojo.html#testClassesDirectory}test-classes}} directory
 
35
 
 
36
  [[2]] The {{{../test-mojo.html#classesDirectory}classes}} directory
 
37
 
 
38
#{else}
 
39
  [[1]] The {{{../integration-test-mojo.html#testClassesDirectory}test-classes}} directory
 
40
 
 
41
  [[2]] The {{{../integration-test-mojo.html#classesDirectory}classes}} directory
 
42
 
 
43
#{end}
 
44
  [[3]] The project dependencies
 
45
 
 
46
  [[4]] Additional classpath elements
 
47
 
 
48
Additional Classpath Elements
 
49
 
 
50
  If you need to put more stuff in your classpath when ${thisPlugin} executes (e.g some funky resources or a container specific JAR),
 
51
  we normally recommend you add it to your classpath as a dependency.  Consider deploying shared jars to a private remote repository for your
 
52
  organization.
 
53
 
 
54
  But, if you must, you can use the <<<additionalClasspathElements>>> element to add custom resources/jars to your classpath.
 
55
  This will be treated as an absolute file system path, so you may want use $\{basedir\} or another property combined with a relative path.
 
56
  Note that additional classpath elements are added to the end of the classpath, so you cannot use these to
 
57
  override project dependencies or resources.
 
58
 
 
59
+---+
 
60
<project>
 
61
  [...]
 
62
  <build>
 
63
    <plugins>
 
64
      <plugin>
 
65
        <groupId>${project.groupId}</groupId>
 
66
        <artifactId>${project.artifactId}</artifactId>
 
67
        <version>${project.version}</version>
 
68
        <configuration>
 
69
          <additionalClasspathElements>
 
70
            <additionalClasspathElement>path/to/additional/resources</additionalClasspathElement>
 
71
            <additionalClasspathElement>path/to/additional/jar</additionalClasspathElement>
 
72
          </additionalClasspathElements>
 
73
        </configuration>
 
74
      </plugin>
 
75
    </plugins>
 
76
  </build>
 
77
  [...]
 
78
</project>
 
79
+---+
 
80
 
 
81
Removing Dependency Classpath Elements
 
82
 
 
83
  Dependencies can be removed from the test classpath using the parameters <<<classpathDependencyExcludes>>> and
 
84
  <<<classpathDependencyScopeExclude>>>.  A list of specific dependencies can be removed from the
 
85
  classpath by specifying the groupId:artifactId to be removed.
 
86
 
 
87
+---+
 
88
<project>
 
89
  [...]
 
90
  <build>
 
91
    <plugins>
 
92
      <plugin>
 
93
        <groupId>${project.groupId}</groupId>
 
94
        <artifactId>${project.artifactId}</artifactId>
 
95
        <version>${project.version}</version>
 
96
        <configuration>
 
97
          <classpathDependencyExcludes>
 
98
            <classpathDependencyExcludes>org.apache.commons:commons-email</classpathDependencyExcludes>
 
99
          </classpathDependencyExcludes>
 
100
        </configuration>
 
101
      </plugin>
 
102
    </plugins>
 
103
  </build>
 
104
  [...]
 
105
</project>
 
106
+---+
 
107
 
 
108
  Dependencies under a certain scope can be removed from the classpath using
 
109
  <<<classpathDependencyScopeExclude>>>.  The valid values for the dependency scope
 
110
  exclude are defined by <<<org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter>>>.
 
111
 
 
112
  * <<compile>> - system, provided, compile
 
113
 
 
114
  * <<runtime>> - compile, runtime
 
115
 
 
116
  * <<test>> - system, provided, compile, runtime, test
 
117
 
 
118
+---+
 
119
<project>
 
120
  [...]
 
121
  <build>
 
122
    <plugins>
 
123
      <plugin>
 
124
        <groupId>${project.groupId}</groupId>
 
125
        <artifactId>${project.artifactId}</artifactId>
 
126
        <version>${project.version}</version>
 
127
        <configuration>
 
128
          <classpathDependencyScopeExclude>runtime</classpathDependencyScopeExclude>
 
129
        </configuration>
 
130
      </plugin>
 
131
    </plugins>
 
132
  </build>
 
133
  [...]
 
134
</project>
 
135
+---+