Allow integration tests to use custom repos
Update integration tests so that they can use a custom local Maven repository. See gh-9316
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<maven.home>${maven.home}</maven.home>
|
||||
<repository>${repository}</repository>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
@@ -37,6 +38,7 @@ import org.apache.maven.shared.invoker.MavenInvocationException;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -128,6 +130,12 @@ class ApplicationBuilder {
|
||||
InvocationRequest invocation = new DefaultInvocationRequest();
|
||||
invocation.setBaseDirectory(appFolder);
|
||||
invocation.setGoals(Collections.singletonList("package"));
|
||||
String repository = System.getProperty("repository");
|
||||
if (StringUtils.hasText(repository) && !repository.equals("${repository}")) {
|
||||
Properties properties = new Properties();
|
||||
properties.put("repository", repository);
|
||||
invocation.setProperties(properties);
|
||||
}
|
||||
InvocationResult execute = new DefaultInvoker().execute(invocation);
|
||||
assertThat(execute.getExitCode()).isEqualTo(0);
|
||||
}
|
||||
|
||||
@@ -61,4 +61,32 @@
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>repository</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>repository</name>
|
||||
</property>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>repository</id>
|
||||
<url>${repository}</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>repository</id>
|
||||
<url>${repository}</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user