diff --git a/pitest-maven/src/main/java/org/pitest/maven/AbstractPitMojo.java b/pitest-maven/src/main/java/org/pitest/maven/AbstractPitMojo.java
index 979e0eedd..665d6f393 100644
--- a/pitest-maven/src/main/java/org/pitest/maven/AbstractPitMojo.java
+++ b/pitest-maven/src/main/java/org/pitest/maven/AbstractPitMojo.java
@@ -7,6 +7,7 @@
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.Settings;
import org.eclipse.aether.RepositorySystem;
import org.pitest.coverage.CoverageSummary;
import org.pitest.mutationtest.config.PluginServices;
@@ -385,6 +386,9 @@ public class AbstractPitMojo extends AbstractMojo {
@Parameter(property = "project", readonly = true, required = true)
private MavenProject project;
+ @Parameter(property = "settings", readonly = true, required = true)
+ private Settings settings;
+
/**
* Internal: Map of plugin artifacts.
*/
@@ -630,6 +634,10 @@ public MavenProject getProject() {
return this.project;
}
+ public Settings getSettings() {
+ return this.settings;
+ }
+
public Map getPluginArtifactMap() {
return this.pluginArtifactMap;
}
diff --git a/pitest-maven/src/main/java/org/pitest/maven/MojoToReportOptionsConverter.java b/pitest-maven/src/main/java/org/pitest/maven/MojoToReportOptionsConverter.java
index 1ae0207e0..132508aa2 100644
--- a/pitest-maven/src/main/java/org/pitest/maven/MojoToReportOptionsConverter.java
+++ b/pitest-maven/src/main/java/org/pitest/maven/MojoToReportOptionsConverter.java
@@ -500,6 +500,8 @@ private String replacePropertyExpressions(String argLine) {
argLine = replaceFieldForSymbol('$', key, argLine);
}
+ argLine = replaceSettingsField(argLine);
+
return argLine;
}
@@ -511,4 +513,12 @@ private String replaceFieldForSymbol(char symbol, String key, String argLine) {
return argLine;
}
+ private String replaceSettingsField(String argLine) {
+ String field = "${settings.localRepository}";
+ if (argLine.contains(field)) {
+ return argLine.replace(field, mojo.getSettings().getLocalRepository());
+ }
+ return argLine;
+ }
+
}
diff --git a/pitest-maven/src/test/java/org/pitest/maven/BasePitMojoTest.java b/pitest-maven/src/test/java/org/pitest/maven/BasePitMojoTest.java
index 21419f6de..cf31e4120 100644
--- a/pitest-maven/src/test/java/org/pitest/maven/BasePitMojoTest.java
+++ b/pitest-maven/src/test/java/org/pitest/maven/BasePitMojoTest.java
@@ -30,6 +30,7 @@
import org.apache.maven.model.Build;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.Settings;
import org.codehaus.plexus.configuration.PlexusConfiguration;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
@@ -45,6 +46,9 @@ public abstract class BasePitMojoTest extends AbstractMojoTestCase {
@Mock
protected MavenProject project;
+ @Mock
+ protected Settings settings;
+
@Mock
protected RunPitStrategy executionStrategy;
@@ -119,6 +123,8 @@ protected void configurePitMojo(final AbstractPitMojo pitMojo, final String conf
setVariableValueToObject(pitMojo, "project", this.project);
+ setVariableValueToObject(pitMojo, "settings", this.settings);
+
if (pitMojo.getAdditionalClasspathElements() == null) {
ArrayList elements = new ArrayList<>();
setVariableValueToObject(pitMojo, "additionalClasspathElements", elements);
diff --git a/pitest-maven/src/test/java/org/pitest/maven/MojoToReportOptionsConverterTest.java b/pitest-maven/src/test/java/org/pitest/maven/MojoToReportOptionsConverterTest.java
index 410a81982..3529234de 100644
--- a/pitest-maven/src/test/java/org/pitest/maven/MojoToReportOptionsConverterTest.java
+++ b/pitest-maven/src/test/java/org/pitest/maven/MojoToReportOptionsConverterTest.java
@@ -459,6 +459,12 @@ public void testEvaluatesNormalPropertiesInArgLines() {
assertThat(actual.getArgLine()).isEqualTo("fooValue barValue");
}
+ public void testEvaluatesLocalRepositoryPropertyInArgLines() {
+ when(this.settings.getLocalRepository()).thenReturn("localRepoValue");
+ ReportOptions actual = parseConfig("${settings.localRepository}/jar");
+ assertThat(actual.getArgLine()).isEqualTo("localRepoValue/jar");
+ }
+
public void testAutoAddsKotlinSourceDirsWhenPresent() throws IOException {
// we're stuck in junit 3 land but can
// use junit 4's temporary folder rule programatically