Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions Jenkinsfile

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.nio.file.Path;
import java.util.List;
import java.util.Map;

import org.apache.maven.api.Language;
import org.apache.maven.api.ProjectScope;
Expand Down Expand Up @@ -53,6 +54,7 @@ public class TestResourcesMojo extends ResourcesMojo {
/**
* Set this to 'true' to bypass copying of test resources.
* Its use is NOT RECOMMENDED, but quite convenient on occasion.
*
* @since 2.6
*/
@Parameter(property = "maven.test.skip", defaultValue = "false")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For compatibility reasons, the parameter can't be removed here, even if it's use is a no-op

Expand All @@ -62,7 +64,7 @@ public class TestResourcesMojo extends ResourcesMojo {
* {@inheritDoc}
*/
public void execute() throws MojoException {
if (skip) {
if (skip || isTestSkip()) {
getLog().info("Not copying test resources");
return;
}
Expand All @@ -75,6 +77,23 @@ public void execute() throws MojoException {
super.doExecute();
}

/**
* Returns {@code true} if test resource copying should be skipped.
* Checks both the inherited {@code skip} parameter (bound to {@code maven.resources.skip})
* and the {@code maven.test.skip} property from the session.
*
* @return {@code true} if test resources should not be copied
*/
private boolean isTestSkip() {
if (isSkip()) {
return true;
}
Map<String, String> userProps = session.getUserProperties();
Map<String, String> sysProps = session.getSystemProperties();
String testSkip = userProps.getOrDefault("maven.test.skip", sysProps.get("maven.test.skip"));
return Boolean.parseBoolean(testSkip);
}

/** {@inheritDoc} */
public Path getOutputDirectory() {
return outputDirectory;
Expand Down
Loading