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 746e65278..965cba0f5 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;
@@ -401,6 +402,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.
*/
@@ -668,6 +672,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 1042e0c76..8bb9068be 100644
--- a/pitest-maven/src/main/java/org/pitest/maven/MojoToReportOptionsConverter.java
+++ b/pitest-maven/src/main/java/org/pitest/maven/MojoToReportOptionsConverter.java
@@ -568,6 +568,8 @@ private String replacePropertyExpressions(String argLine) {
argLine = replaceFieldForSymbol('$', key, argLine);
}
+ argLine = replaceSettingsField(argLine);
+
return argLine;
}
@@ -579,4 +581,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 204c74e91..aed0e6a35 100644
--- a/pitest-maven/src/test/java/org/pitest/maven/BasePitMojoTest.java
+++ b/pitest-maven/src/test/java/org/pitest/maven/BasePitMojoTest.java
@@ -31,6 +31,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;
@@ -49,6 +50,9 @@ public abstract class BasePitMojoTest extends AbstractMojoTestCase {
@Mock
protected MavenSession session;
+ @Mock
+ protected Settings settings;
+
@Mock
protected RunPitStrategy executionStrategy;
@@ -123,6 +127,7 @@ protected void configurePitMojo(final AbstractPitMojo pitMojo, final String conf
setVariableValueToObject(pitMojo, "project", this.project);
setVariableValueToObject(pitMojo, "session", this.session);
+ setVariableValueToObject(pitMojo, "settings", this.settings);
if (pitMojo.getAdditionalClasspathElements() == null) {
ArrayList elements = new ArrayList<>();
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 57f28d5e1..118388cc0 100644
--- a/pitest-maven/src/test/java/org/pitest/maven/MojoToReportOptionsConverterTest.java
+++ b/pitest-maven/src/test/java/org/pitest/maven/MojoToReportOptionsConverterTest.java
@@ -469,6 +469,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 testAddsModulesToMutationPathWhenCrossModule() {
MavenProject dependedOn = project("com.example", "foo");
MavenProject notDependedOn = project("com.example", "bar");