File tree Expand file tree Collapse file tree 4 files changed +58
-2
lines changed
Expand file tree Collapse file tree 4 files changed +58
-2
lines changed Original file line number Diff line number Diff line change 103103 </properties >
104104
105105 <build >
106+ <resources >
107+ <resource >
108+ <directory >src/main/resources</directory >
109+ <filtering >true</filtering >
110+ </resource >
111+ </resources >
106112 <pluginManagement >
107113 <plugins >
108114 <plugin >
Original file line number Diff line number Diff line change 1515 name = "godiddy-cli" ,
1616 description = "Godiddy Universal DID Operations" ,
1717 footer = "See https://docs.godiddy.com/ for more information." ,
18- version = "1.0.0" ,
18+ versionProvider = GodiddyRootCommand . GodiddyVersionProvider . class ,
1919 mixinStandardHelpOptions = true ,
2020 subcommands = {
2121 ConfigRootCommand .class ,
3232 }
3333)
3434public class GodiddyRootCommand extends GodiddyAbstractCommand implements Callable <Integer > {
35- }
35+
36+ static class GodiddyVersionProvider implements CommandLine .IVersionProvider {
37+ @ Override
38+ public String [] getVersion () {
39+ return new String [] { Version .VERSION };
40+ }
41+ }
42+
43+ @ Override
44+ public Integer call () {
45+ // Your existing implementation
46+ return 0 ;
47+ }
48+ }
Original file line number Diff line number Diff line change 1+ package com .godiddy .cli ;
2+
3+ import java .io .IOException ;
4+ import java .io .InputStream ;
5+ import java .util .Properties ;
6+
7+ public final class Version {
8+
9+ private static final String VERSION_FILE = "version.properties" ;
10+ public static final String VERSION ;
11+
12+ static {
13+ String version ;
14+ try (InputStream is = Version .class .getClassLoader ().getResourceAsStream (VERSION_FILE )) {
15+ if (is == null ) {
16+ throw new RuntimeException ("Version properties file not found: " + VERSION_FILE );
17+ }
18+
19+ Properties props = new Properties ();
20+ props .load (is );
21+
22+ version = props .getProperty ("version" );
23+ if (version == null || version .isEmpty ()) {
24+ throw new RuntimeException ("Version not defined in properties file" );
25+ }
26+ } catch (IOException e ) {
27+ throw new RuntimeException ("Failed to load version properties" , e );
28+ }
29+
30+ VERSION = version ;
31+ }
32+
33+ private Version () {
34+ // Prevent instantiation
35+ }
36+ }
Original file line number Diff line number Diff line change 1+ version =${project.version}
You can’t perform that action at this time.
0 commit comments