Added version information to jar which can be used on the command
line e.g. java -jar monasca-thresh.jar --version Change-Id: If1b6dc46ddac063d78b956fa43372cc4d30787fc
This commit is contained in:
parent
7795d7cc3a
commit
2f0e0792fa
|
@ -21,6 +21,8 @@
|
||||||
<skipITs>false</skipITs>
|
<skipITs>false</skipITs>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<timestamp>${maven.build.timestamp}</timestamp>
|
||||||
|
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss</maven.build.timestamp.format>
|
||||||
<artifactNamedVersion>${project.artifactId}-${project.version}-${timestamp}-${buildNumber}
|
<artifactNamedVersion>${project.artifactId}-${project.version}-${timestamp}-${buildNumber}
|
||||||
</artifactNamedVersion>
|
</artifactNamedVersion>
|
||||||
<shadedJarName>${project.artifactId}-${project.version}-shaded
|
<shadedJarName>${project.artifactId}-${project.version}-shaded
|
||||||
|
@ -200,6 +202,21 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<packageName>monasca.thresh</packageName>
|
||||||
|
</manifest>
|
||||||
|
<manifestEntries>
|
||||||
|
<Implementation-Version>${artifactNamedVersion}</Implementation-Version>
|
||||||
|
</manifestEntries>
|
||||||
|
</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>
|
||||||
|
|
|
@ -59,8 +59,20 @@ public class ThresholdingEngine {
|
||||||
|
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This should allow command line options to show the current version java
|
||||||
|
* -jar monasca-thresh.jar --version java -jar monasca-thresh.jar -version
|
||||||
|
* java -jar monasca-thresh.jar version Really anything with the word
|
||||||
|
* version in it will show the version as long as there is only one argument
|
||||||
|
*/
|
||||||
|
if (args.length == 1 && args[0].toLowerCase().contains("version")) {
|
||||||
|
showVersion();
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
// Let's show the logging status.
|
// Let's show the logging status.
|
||||||
StatusPrinter.print((LoggerContext) LoggerFactory.getILoggerFactory());
|
StatusPrinter.print((LoggerContext) LoggerFactory.getILoggerFactory());
|
||||||
|
showVersion();
|
||||||
|
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
logger.error("Expected configuration file name and topology name arguments");
|
logger.error("Expected configuration file name and topology name arguments");
|
||||||
|
@ -76,6 +88,14 @@ public class ThresholdingEngine {
|
||||||
engine.run();
|
engine.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void showVersion() {
|
||||||
|
Package pkg;
|
||||||
|
pkg = Package.getPackage("monasca.thresh");
|
||||||
|
|
||||||
|
logger.info("-------- Version Information --------");
|
||||||
|
logger.info("{}", pkg.getImplementationVersion());
|
||||||
|
}
|
||||||
|
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
Injector.registerModules(new TopologyModule(threshConfig));
|
Injector.registerModules(new TopologyModule(threshConfig));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue