File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
main/java/org/contextmapper/cli
test/java/org/contextmapper/cli Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,15 @@ application {
3535startScripts {
3636 applicationName = ' cm'
3737}
38+ jar {
39+ manifest {
40+ attributes (
41+ ' Implementation-Title' : ' Context Mapper Command Line Interface (CLI)' ,
42+ ' Implementation-Version' : project. version,
43+ ' Main-Class' : ' org.contextmapper.cli.ContextMapperCLI'
44+ )
45+ }
46+ }
3847
3948if (! project. hasProperty(' signing.secretKeyRingFile' )) {
4049 project. ext. ' signing.secretKeyRingFile' = " ${ rootDir} /secret-key.gpg"
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ public static void main(String[] args) {
3939 }
4040
4141 protected void run (String [] args ) {
42- System .out .println ("Context Mapper CLI" );
42+ System .out .println ("Context Mapper CLI " + getVersion () );
4343
4444 if (args == null || args .length == 0 ) {
4545 printUsages ();
@@ -54,4 +54,9 @@ private void printUsages() {
5454 System .out .println ("Usage: cm " + COMPILE_COMMAND + "|" + GENERATE_COMMAND + " [options]" );
5555 }
5656
57+ private String getVersion () {
58+ String implVersion = ContextMapperCLI .class .getPackage ().getImplementationVersion ();
59+ return implVersion != null ? "v" + implVersion : "DEVELOPMENT VERSION" ;
60+ }
61+
5762}
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ void main_WhenCalledWithoutCommand_ThenPrintUsage() {
6969 ContextMapperCLI .main (params );
7070
7171 // then
72- assertThat (outContent .toString ()).isEqualTo ("Context Mapper CLI" + System .lineSeparator () +
72+ assertThat (outContent .toString ()).isEqualTo ("Context Mapper CLI DEVELOPMENT VERSION " + System .lineSeparator () +
7373 "Usage: cm compile|generate [options]" + System .lineSeparator ());
7474 }
7575
@@ -82,7 +82,7 @@ void run_WhenCalledWithoutCommand_ThenPrintUsage() {
8282 contextMapperCLI .run (params );
8383
8484 // then
85- assertThat (outContent .toString ()).isEqualTo ("Context Mapper CLI" + System .lineSeparator () +
85+ assertThat (outContent .toString ()).isEqualTo ("Context Mapper CLI DEVELOPMENT VERSION " + System .lineSeparator () +
8686 "Usage: cm compile|generate [options]" + System .lineSeparator ());
8787 }
8888
You can’t perform that action at this time.
0 commit comments