</execution>
</executions>
</plugin>
+ <plugin>
+ <artifactId>maven-help-plugin</artifactId>
+ <configuration>
+ <output>${project.build.directory}/effective-settings.xml</output>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>effective-settings</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Arrays;
+import java.util.Optional;
import java.util.Properties;
import org.apache.maven.it.VerificationException;
import org.apache.maven.it.Verifier;
if (GLOBAL_SETTINGS_OVERRIDE != null) {
verifier.addCliOption("-gs");
verifier.addCliOption(GLOBAL_SETTINGS_OVERRIDE);
+ } else if (getEffectiveSettingsXML().isPresent()) {
+ verifier.addCliOption("-gs");
+ verifier.addCliOption(getEffectiveSettingsXML().get());
}
if (USER_SETTINGS_OVERRIDE != null) {
verifier.addCliOption("-s");
return sp.getProperty("target.dir");
}
+ private static Optional<String> getEffectiveSettingsXML() throws URISyntaxException, VerificationException, IOException {
+ final URL path = YangToSourcesPluginTestIT.class.getResource("/test-parent/pom.xml");
+ File buildDir = new File(path.toURI()).getParentFile().getParentFile().getParentFile();
+ File effectiveSettingsXML = new File(buildDir, "effective-settings.xml");
+ if (effectiveSettingsXML.exists()) {
+ return Optional.of(effectiveSettingsXML.getAbsolutePath());
+ } else {
+ fail(effectiveSettingsXML.getAbsolutePath());
+ return Optional.empty();
+ }
+ }
+
}