Skip to content

Commit 727c669

Browse files
committed
[MDEP-749] improve include/exclude scope documentation
1 parent 26abf6c commit 727c669

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractDependencyFilterMojo.java

+23-15
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,15 @@ public abstract class AbstractDependencyFilterMojo
122122
protected String excludeTypes;
123123

124124
/**
125-
* Scope to include. An Empty string indicates all scopes (default). The scopes being interpreted are the scopes as
126-
* Maven sees them, not as specified in the pom. In summary:
125+
* Scope to include. An empty string indicates include all dependencies (default).<br>
126+
* The selected scope value being interpreted is the scope as
127+
* Maven filters for creating a classpath, not as specified in the pom. In summary:
127128
* <ul>
128-
* <li><code>runtime</code> scope gives runtime and compile dependencies,</li>
129-
* <li><code>compile</code> scope gives compile, provided, and system dependencies,</li>
130-
* <li><code>test</code> (default) scope gives all dependencies,</li>
131-
* <li><code>provided</code> scope just gives provided dependencies,</li>
132-
* <li><code>system</code> scope just gives system dependencies.</li>
129+
* <li><code>runtime</code> include scope gives runtime and compile dependencies,</li>
130+
* <li><code>compile</code> include scope gives compile, provided, and system dependencies,</li>
131+
* <li><code>test</code> include scope gives all dependencies (equivalent to default),</li>
132+
* <li><code>provided</code> include scope just gives provided dependencies,</li>
133+
* <li><code>system</code> include scope just gives system dependencies.</li>
133134
* </ul>
134135
*
135136
* @since 2.0
@@ -138,15 +139,16 @@ public abstract class AbstractDependencyFilterMojo
138139
protected String includeScope;
139140

140141
/**
141-
* Scope to exclude. An Empty string indicates no scopes (default). The scopes being interpreted are the scopes as
142-
* Maven sees them, not as specified in the pom. In summary:
142+
* Scope to exclude. An empty string indicates no dependencies (default).<br>
143+
* The selected scope value being interpreted is the scope as
144+
* Maven filters for creating a classpath, not as specified in the pom. In summary:
143145
* <ul>
144-
* <li><code>runtime</code> scope excludes runtime and compile dependencies,</li>
145-
* <li><code>compile</code> scope excludes compile, provided, and system dependencies,</li>
146-
* <li><code>test</code> scope excludes all dependencies, then not really a legitimate option: it will fail,
147-
* you probably meant to configure includeScope = compile or runtime</li>
148-
* <li><code>provided</code> scope just excludes provided dependencies,</li>
149-
* <li><code>system</code> scope just excludes system dependencies.</li>
146+
* <li><code>runtime</code> exclude scope excludes runtime and compile dependencies,</li>
147+
* <li><code>compile</code> exclude scope excludes compile, provided, and system dependencies,</li>
148+
* <li><code>test</code> exclude scope excludes all dependencies, then not really a legitimate option: it will
149+
* fail, you probably meant to configure includeScope = compile</li>
150+
* <li><code>provided</code> exclude scope just excludes provided dependencies,</li>
151+
* <li><code>system</code> exclude scope just excludes system dependencies.</li>
150152
* </ul>
151153
*
152154
* @since 2.0
@@ -294,6 +296,12 @@ protected DependencyStatusSets getDependencySets( boolean stopOnFailure, boolean
294296
filter.addFilter( new ProjectTransitivityFilter( getProject().getDependencyArtifacts(),
295297
this.excludeTransitive ) );
296298

299+
if ( "test".equals( this.excludeScope ) )
300+
{
301+
throw new MojoExecutionException( "Excluding every artifact inside 'test' resolution scope means "
302+
+ "excluding everything: you probably want includeScope='compile', "
303+
+ "read parameters documentation for detailed explanations" );
304+
}
297305
filter.addFilter( new ScopeFilter( DependencyUtil.cleanToBeTokenizedString( this.includeScope ),
298306
DependencyUtil.cleanToBeTokenizedString( this.excludeScope ) ) );
299307

0 commit comments

Comments
 (0)