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 89
89
</programs >
90
90
</configuration >
91
91
</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 >
127
92
<plugin >
128
93
<groupId >org.apache.maven.plugins</groupId >
129
94
<artifactId >maven-surefire-plugin</artifactId >
162
127
</dependencies >
163
128
</plugin >
164
129
</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 >
165
146
</build >
166
147
167
148
<repositories >
Original file line number Diff line number Diff line change 1
1
package org .utplsql .cli ;
2
2
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
+
3
11
/** This class is getting updated automatically by the build process.
4
12
* Please do not update its constants manually cause they will be overwritten.
5
13
*
6
14
* @author pesse
7
15
*/
8
16
public class CliVersionInfo {
9
17
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" ;
13
20
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
+ }
16
33
}
17
34
35
+ public static String getVersion () { return MAVEN_PROJECT_VERSION ; }
18
36
public static String getInfo () { return MAVEN_PROJECT_NAME + " " + getVersion (); }
19
37
38
+
20
39
}
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