Add support for maven local xml config file - Fixes
@@ -22,12 +22,16 @@ import com.google.common.io.CharStreams;
import java.io.File;
import java.io.InputStreamReader;
import java.nio.file.Files;
+import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
+
+import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -148,8 +152,22 @@ public class MavenUtils {
private static void downloadArtifact(String artifact) throws Exception {
X.println("Downloading artifact... Identifier: " + artifact);
- exec(buildMvnCommand() + " org.apache.maven.plugins:maven-dependency-plugin:3.0.2:get -Dartifact=" + artifact +
- (useGgRepo ? " -DremoteRepositories=" + GG_MVN_REPO : ""));
+ // Default platform independ path for maven settings file.
+ Path localProxyMavenSettings = Paths.get(System.getProperty("user.home"), ".m2", "local-proxy.xml");
+
+ String localProxyMavenSettingsFromEnv = System.getenv("LOCAL_PROXY_MAVEN_SETTINGS");
+
+ SB mavenCommandArgs = new SB(" org.apache.maven.plugins:maven-dependency-plugin:3.0.2:get -Dartifact=" + artifact);
+
+ if (!F.isEmpty(localProxyMavenSettingsFromEnv))
+ localProxyMavenSettings = Paths.get(localProxyMavenSettingsFromEnv);
+
+ if (Files.exists(localProxyMavenSettings))
+ mavenCommandArgs.a(" -s " + localProxyMavenSettings.toString());
+ else
+ mavenCommandArgs.a(useGgRepo ? " -DremoteRepositories=" + GG_MVN_REPO : "");
+
+ exec(buildMvnCommand() + mavenCommandArgs.toString());
X.println("Download is finished");
}
