Merge relevant changes from 'druid-version-info'

This commit is contained in:
Himadri Singh 2013-12-04 10:21:19 +05:30
parent 95fafe02a7
commit 47278ad109
14 changed files with 191 additions and 10 deletions

View File

@ -53,4 +53,20 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -168,7 +168,15 @@
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> <configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -104,6 +104,14 @@
</goals> </goals>
</execution> </execution>
</executions> </executions>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -71,4 +71,20 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -101,6 +101,17 @@
<build> <build>
<plugins> <plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin> <plugin>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<executions> <executions>

View File

@ -160,4 +160,20 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -116,4 +116,20 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -55,4 +55,19 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -133,6 +133,14 @@
</goals> </goals>
</execution> </execution>
</executions> </executions>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -74,6 +74,7 @@
<archive> <archive>
<manifest> <manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries> <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest> </manifest>
</archive> </archive>
</configuration> </configuration>

View File

@ -224,17 +224,9 @@
<artifactId>caliper</artifactId> <artifactId>caliper</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<resources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
@ -245,6 +237,14 @@
</goals> </goals>
</execution> </execution>
</executions> </executions>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.antlr</groupId> <groupId>org.antlr</groupId>

View File

@ -51,8 +51,20 @@
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>

View File

@ -27,6 +27,8 @@ import io.druid.cli.convert.ConvertProperties;
import io.druid.cli.validate.DruidJsonValidator; import io.druid.cli.validate.DruidJsonValidator;
import io.druid.initialization.Initialization; import io.druid.initialization.Initialization;
import io.druid.server.initialization.ExtensionsConfig; import io.druid.server.initialization.ExtensionsConfig;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import java.util.List; import java.util.List;
@ -41,7 +43,13 @@ public class Main
builder.withDescription("Druid command-line runner.") builder.withDescription("Druid command-line runner.")
.withDefaultCommand(Help.class) .withDefaultCommand(Help.class)
.withCommands(Help.class); .withCommands(Help.class, Version.class);
Runnable cmd = builder.build().parse(args);
if (cmd instanceof Version) {
Logger.getRootLogger().setLevel(Level.OFF);
}
builder.withGroup("server") builder.withGroup("server")
.withDescription("Run one of the Druid server types.") .withDescription("Run one of the Druid server types.")

View File

@ -0,0 +1,46 @@
package io.druid.cli;
import io.airlift.command.Command;
import io.druid.initialization.DruidModule;
import io.druid.initialization.Initialization;
import io.druid.server.initialization.ExtensionsConfig;
@Command(
name = "version",
description = "Returns Druid version information"
)
public class Version implements Runnable {
@Override
public void run()
{
System.out.println("Druid version " + Initialization.class.getPackage().getImplementationVersion());
System.out.println("Druid API version " + DruidModule.class.getPackage().getImplementationVersion());
ExtensionsConfig config = Initialization.makeStartupInjector().getInstance(ExtensionsConfig.class);
System.out.println("");
System.out.println("Registered Druid Modules");
for (DruidModule module : Initialization.getFromExtensions(config, DruidModule.class)) {
String artifact = module.getClass().getPackage().getImplementationTitle();
String version = module.getClass().getPackage().getImplementationVersion();
if(artifact != null) {
System.out.println(
String.format(
" - %s (%s-%s)",
module.getClass().getCanonicalName(),
module.getClass().getPackage().getImplementationTitle(),
module.getClass().getPackage().getImplementationVersion()
)
);
} else {
System.out.println(
String.format(
" - %s",
module.getClass().getCanonicalName()
)
);
}
}
}
}