diff --git a/services/src/main/java/io/druid/cli/CliHadoopIndexer.java b/services/src/main/java/io/druid/cli/CliHadoopIndexer.java index 25d8a28a935..d41711852b3 100644 --- a/services/src/main/java/io/druid/cli/CliHadoopIndexer.java +++ b/services/src/main/java/io/druid/cli/CliHadoopIndexer.java @@ -46,20 +46,21 @@ import java.util.List; public class CliHadoopIndexer implements Runnable { - private static String defaultHadoopCoordinates = "org.apache.hadoop:hadoop-client:2.3.0"; + private static final String DEFAULT_HADOOP_COORDINATES = "org.apache.hadoop:hadoop-client:2.3.0"; private static final Logger log = new Logger(CliHadoopIndexer.class); @Arguments(description = "A JSON object or the path to a file that contains a JSON object", required = true) private String argumentSpec; - @Option(name = "hadoop", - description = "The maven coordinates to the version of hadoop to run with. Defaults to org.apache.hadoop:hadoop-client:2.3.0") - private String hadoopCoordinates = defaultHadoopCoordinates; + @Option(name = {"-c", "--coordinate", "hadoopDependencies"}, + description = "extra dependencies to pull down (e.g. non-default hadoop coordinates or extra hadoop jars)") + private List coordinates; - @Option(name = "hadoopDependencies", - description = "The maven coordinates to the version of hadoop and all dependencies to run with. Defaults to using org.apache.hadoop:hadoop-client:2.3.0") - private List hadoopDependencyCoordinates = Arrays.asList(defaultHadoopCoordinates); + @Option(name = "--no-default-hadoop", + description = "don't pull down the default hadoop version (currently " + DEFAULT_HADOOP_COORDINATES + ")", + required = false) + public boolean noDefaultHadoop; @Inject private ExtensionsConfig extensionsConfig = null; @@ -69,6 +70,14 @@ public class CliHadoopIndexer implements Runnable public void run() { try { + final List allCoordinates = Lists.newArrayList(); + if (coordinates != null) { + allCoordinates.addAll(coordinates); + } + if (!noDefaultHadoop) { + allCoordinates.add(DEFAULT_HADOOP_COORDINATES); + } + final DefaultTeslaAether aetherClient = Initialization.getAetherClient(extensionsConfig); final List extensionURLs = Lists.newArrayList(); @@ -85,7 +94,7 @@ public class CliHadoopIndexer implements Runnable final List driverURLs = Lists.newArrayList(); driverURLs.addAll(nonHadoopURLs); // put hadoop dependencies last to avoid jets3t & apache.httpcore version conflicts - for (String coordinate : hadoopDependencyCoordinates) { + for (String coordinate : allCoordinates) { final ClassLoader hadoopLoader = Initialization.getClassLoaderForCoordinates( aetherClient, coordinate ); diff --git a/services/src/main/java/io/druid/cli/PullDependencies.java b/services/src/main/java/io/druid/cli/PullDependencies.java index f12c167a0d5..bb950d13f5d 100644 --- a/services/src/main/java/io/druid/cli/PullDependencies.java +++ b/services/src/main/java/io/druid/cli/PullDependencies.java @@ -39,7 +39,7 @@ import java.util.List; ) public class PullDependencies implements Runnable { - @Option(name = "-c", + @Option(name = {"-c", "--coordinate"}, title = "coordinate", description = "extra dependencies to pull down (e.g. hadoop coordinates)", required = false)