support Implementation-Version

This commit is contained in:
hengyunabc committed 2018-09-07 00:55:40 +08:00
1 parent 32fc04d64d
commit 996fb4d827
2 files changed
+16 -3

No files matched your search

+4
View File
@@ -49,6 +49,10 @@
</manifest> </manifest>
<manifestEntries> <manifestEntries>
<Created-By>core engine team, middleware group, alibaba inc.</Created-By> <Created-By>core engine team, middleware group, alibaba inc.</Created-By>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Vendor-Id>com.taobao.arthas</Implementation-Vendor-Id>
<Specification-Version>${project.version}</Specification-Version>
<Specification-Title>arthas-core</Specification-Title>
</manifestEntries> </manifestEntries>
</archive> </archive>
</configuration> </configuration>
@@ -8,6 +8,7 @@ import com.taobao.text.ui.TableElement;
import com.taobao.text.util.RenderUtil; import com.taobao.text.util.RenderUtil;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import static com.taobao.text.ui.Element.label; import static com.taobao.text.ui.Element.label;
@@ -30,7 +31,15 @@ public class ArthasBanner {
try { try {
String logoText = IOUtils.toString(ShellServerOptions.class.getResourceAsStream(LOGO_LOCATION)); String logoText = IOUtils.toString(ShellServerOptions.class.getResourceAsStream(LOGO_LOCATION));
THANKS = IOUtils.toString(ShellServerOptions.class.getResourceAsStream(CREDIT_LOCATION)); THANKS = IOUtils.toString(ShellServerOptions.class.getResourceAsStream(CREDIT_LOCATION));
VERSION = IOUtils.toString(ShellServerOptions.class.getResourceAsStream(VERSION_LOCATION)); InputStream versionInputStream = ShellServerOptions.class.getResourceAsStream(VERSION_LOCATION);
if (versionInputStream != null) {
VERSION = IOUtils.toString(versionInputStream);
} else {
String implementationVersion = ArthasBanner.class.getPackage().getImplementationVersion();
if (implementationVersion != null) {
VERSION = implementationVersion;
}
}
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
String[] LOGOS = new String[6]; String[] LOGOS = new String[6];
@@ -53,8 +62,8 @@ public class ArthasBanner {
label(LOGOS[4]).style(Decoration.bold.fg(Color.green)), label(LOGOS[4]).style(Decoration.bold.fg(Color.green)),
label(LOGOS[5]).style(Decoration.bold.fg(Color.blue))); label(LOGOS[5]).style(Decoration.bold.fg(Color.blue)));
LOGO = RenderUtil.render(logoTable); LOGO = RenderUtil.render(logoTable);
} catch (IOException ioe) { } catch (Throwable e) {
ioe.printStackTrace(); e.printStackTrace();
} }
} }