Skip to content

Commit a44eb5a

Browse files
committed
[MDEP-939] Lock down classifier in dependency:sources goal
This closes #409
1 parent fd17de4 commit a44eb5a

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

src/it/projects/sources/test.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
# under the License.
1717

1818
outputFile = target/resolved.txt
19+
classifier = foo

src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependencySourcesMojo.java

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
*/
1919
package org.apache.maven.plugins.dependency.resolvers;
2020

21-
import org.apache.maven.plugin.MojoExecutionException;
2221
import org.apache.maven.plugins.annotations.LifecyclePhase;
2322
import org.apache.maven.plugins.annotations.Mojo;
23+
import org.apache.maven.plugins.annotations.Parameter;
2424
import org.apache.maven.plugins.annotations.ResolutionScope;
2525

2626
/**
@@ -36,19 +36,10 @@
3636
threadSafe = true)
3737
public class ResolveDependencySourcesMojo extends ResolveDependenciesMojo {
3838

39-
private static final String SOURCE_CLASSIFIER = "sources";
39+
private static final String SOURCES_CLASSIFIER = "sources";
4040

41-
/**
42-
* Main entry into mojo. Gets the list of dependencies and iterates through resolving the source jars.
43-
*
44-
* @throws MojoExecutionException with a message if an error occurs.
45-
*/
46-
@Override
47-
protected void doExecute() throws MojoExecutionException {
48-
if (this.classifier == null || this.classifier.isEmpty()) {
49-
this.classifier = SOURCE_CLASSIFIER;
50-
}
51-
52-
super.doExecute();
41+
@Parameter(name = "classifier", defaultValue = SOURCES_CLASSIFIER, readonly = true)
42+
public void setClassifier(String classifier) {
43+
this.classifier = classifier;
5344
}
5445
}

0 commit comments

Comments
 (0)