File tree Expand file tree Collapse file tree
java/org/entur/gbfs/validator/cli Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8080 </dependencies >
8181
8282 <build >
83+ <resources >
84+ <resource >
85+ <directory >src/main/resources</directory >
86+ <filtering >true</filtering >
87+ </resource >
88+ </resources >
8389 <plugins >
8490 <!-- Compiler with Picocli annotation processor -->
8591 <plugin >
Original file line number Diff line number Diff line change 2323@ Command (
2424 name = "gbfs-validator" ,
2525 mixinStandardHelpOptions = true ,
26- version = "2.0.52-SNAPSHOT" , // TODO this needs to be injected
26+ versionProvider = VersionProvider . class ,
2727 description = "Validate GBFS feeds against JSON schemas" ,
2828 headerHeading = "Usage:%n%n" ,
2929 synopsisHeading = "%n" ,
Original file line number Diff line number Diff line change 1+ package org .entur .gbfs .validator .cli ;
2+
3+ import java .io .IOException ;
4+ import java .io .InputStream ;
5+ import java .util .Properties ;
6+ import picocli .CommandLine ;
7+
8+ public class VersionProvider implements CommandLine .IVersionProvider {
9+
10+ @ Override
11+ public String [] getVersion () throws Exception {
12+ Properties properties = new Properties ();
13+ try (
14+ InputStream input = getClass ()
15+ .getClassLoader ()
16+ .getResourceAsStream ("version.properties" )
17+ ) {
18+ if (input == null ) {
19+ return new String [] { "Unknown version" };
20+ }
21+ properties .load (input );
22+ String version = properties .getProperty ("version" , "Unknown version" );
23+ return new String [] { version };
24+ } catch (IOException e ) {
25+ return new String [] { "Unknown version" };
26+ }
27+ }
28+ }
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