File tree Expand file tree Collapse file tree 4 files changed +55
-40
lines changed
test/java/org/utplsql/cli Expand file tree Collapse file tree 4 files changed +55
-40
lines changed Original file line number Diff line number Diff line change 8989 </programs >
9090 </configuration >
9191 </plugin >
92- <plugin >
93- <groupId >com.google.code.maven-replacer-plugin</groupId >
94- <artifactId >replacer</artifactId >
95- <version >1.5.3</version >
96- <executions >
97- <execution >
98- <id >replace-version-number</id >
99- <phase >generate-sources</phase >
100- <goals >
101- <goal >replace</goal >
102- </goals >
103- </execution >
104- </executions >
105- <configuration >
106- <basedir >${project.basedir} /src/main/java</basedir >
107- <includes >
108- <include >**/CliVersionInfo.java</include >
109- </includes >
110- <preserveDir >true</preserveDir >
111- <replacements >
112- <replacement >
113- <token >MAVEN_PROJECT_NAME = ".*"</token >
114- <value >MAVEN_PROJECT_NAME = "${project.name} "</value >
115- </replacement >
116- <replacement >
117- <token >MAVEN_PROJECT_VERSION = ".*"</token >
118- <value >MAVEN_PROJECT_VERSION = "${project.version} "</value >
119- </replacement >
120- <replacement >
121- <token >BUILD_NO = ".*"</token >
122- <value >BUILD_NO = "${travisBuildNumber} "</value >
123- </replacement >
124- </replacements >
125- </configuration >
126- </plugin >
12792 <plugin >
12893 <groupId >org.apache.maven.plugins</groupId >
12994 <artifactId >maven-surefire-plugin</artifactId >
162127 </dependencies >
163128 </plugin >
164129 </plugins >
130+ <resources >
131+ <resource >
132+ <directory >src/main/resources</directory >
133+ <filtering >true</filtering >
134+ <includes >
135+ <include >**/utplsql-cli.version</include >
136+ </includes >
137+ </resource >
138+ <resource >
139+ <directory >src/main/resources</directory >
140+ <filtering >false</filtering >
141+ <excludes >
142+ <exclude >**/utplsql-cli.version</exclude >
143+ </excludes >
144+ </resource >
145+ </resources >
165146 </build >
166147
167148 <repositories >
Original file line number Diff line number Diff line change 11package org .utplsql .cli ;
22
3+ import org .utplsql .api .JavaApiVersionInfo ;
4+
5+ import java .io .BufferedReader ;
6+ import java .io .IOException ;
7+ import java .io .InputStream ;
8+ import java .io .InputStreamReader ;
9+ import java .net .URISyntaxException ;
10+
311/** This class is getting updated automatically by the build process.
412 * Please do not update its constants manually cause they will be overwritten.
513 *
614 * @author pesse
715 */
816public class CliVersionInfo {
917
10- private static final String BUILD_NO = "local" ;
11- private static final String MAVEN_PROJECT_NAME = "cli" ;
12- private static final String MAVEN_PROJECT_VERSION = "3.1.1-SNAPSHOT" ;
18+ private static final String MAVEN_PROJECT_NAME = "utPLSL-cli" ;
19+ private static String MAVEN_PROJECT_VERSION = "unknown" ;
1320
14- public static String getVersion () {
15- return MAVEN_PROJECT_VERSION + "." + BUILD_NO ;
21+ static {
22+ try {
23+ try ( InputStream in = JavaApiVersionInfo .class .getClassLoader ().getResourceAsStream ("utplsql-cli.version" )) {
24+ BufferedReader reader = new BufferedReader (new InputStreamReader (in ));
25+ MAVEN_PROJECT_VERSION = reader .readLine ();
26+
27+ reader .close ();
28+ }
29+ }
30+ catch ( IOException e ) {
31+ System .out .println ("WARNING: Could not get Version information!" );
32+ }
1633 }
1734
35+ public static String getVersion () { return MAVEN_PROJECT_VERSION ; }
1836 public static String getInfo () { return MAVEN_PROJECT_NAME + " " + getVersion (); }
1937
38+
2039}
Original file line number Diff line number Diff line change 1+ ${project.version}.${travisBuildNumber}
Original file line number Diff line number Diff line change 1+ package org .utplsql .cli ;
2+
3+ import org .junit .jupiter .api .Test ;
4+ import org .utplsql .api .JavaApiVersionInfo ;
5+
6+ import static org .junit .jupiter .api .Assertions .assertTrue ;
7+
8+ public class CliVersionInfoTest {
9+
10+ @ Test
11+ void getCliVersionInfo () {
12+ assertTrue (CliVersionInfo .getVersion ().startsWith ("3.1" ));
13+ }
14+ }
You can’t perform that action at this time.
0 commit comments