|
|
|
@ -23,6 +23,10 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
|
import org.apache.maven.settings.Profile;
|
|
|
|
|
import org.apache.maven.settings.Repository;
|
|
|
|
|
import org.codehaus.plexus.interpolation.InterpolationException;
|
|
|
|
|
import org.codehaus.plexus.interpolation.Interpolator;
|
|
|
|
|
import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
|
|
|
|
|
import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.cli.compiler.grape.RepositoryConfiguration;
|
|
|
|
|
import org.springframework.boot.cli.compiler.maven.MavenSettings;
|
|
|
|
@ -78,17 +82,37 @@ public final class RepositoryConfigurationFactory {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void addActiveProfileRepositories(List<Profile> activeProfiles,
|
|
|
|
|
List<RepositoryConfiguration> repositoryConfiguration) {
|
|
|
|
|
List<RepositoryConfiguration> configurations) {
|
|
|
|
|
for (Profile activeProfile : activeProfiles) {
|
|
|
|
|
Interpolator interpolator = new RegexBasedInterpolator();
|
|
|
|
|
interpolator.addValueSource(
|
|
|
|
|
new PropertiesBasedValueSource(activeProfile.getProperties()));
|
|
|
|
|
for (Repository repository : activeProfile.getRepositories()) {
|
|
|
|
|
repositoryConfiguration.add(new RepositoryConfiguration(
|
|
|
|
|
repository.getId(), URI.create(repository.getUrl()),
|
|
|
|
|
repository.getSnapshots() != null
|
|
|
|
|
? repository.getSnapshots().isEnabled() : false));
|
|
|
|
|
configurations.add(getRepositoryConfiguration(interpolator, repository));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static RepositoryConfiguration getRepositoryConfiguration(
|
|
|
|
|
Interpolator interpolator, Repository repository) {
|
|
|
|
|
String name = interpolate(interpolator, repository.getId());
|
|
|
|
|
String url = interpolate(interpolator, repository.getUrl());
|
|
|
|
|
boolean snapshotsEnabled = false;
|
|
|
|
|
if (repository.getSnapshots() != null) {
|
|
|
|
|
snapshotsEnabled = repository.getSnapshots().isEnabled();
|
|
|
|
|
}
|
|
|
|
|
return new RepositoryConfiguration(name, URI.create(url), snapshotsEnabled);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String interpolate(Interpolator interpolator, String value) {
|
|
|
|
|
try {
|
|
|
|
|
return interpolator.interpolate(value);
|
|
|
|
|
}
|
|
|
|
|
catch (InterpolationException ex) {
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static File getLocalRepositoryDirectory(String localRepository) {
|
|
|
|
|
if (StringUtils.hasText(localRepository)) {
|
|
|
|
|
return new File(localRepository);
|
|
|
|
|