Skip to content

Commit 04fa93d

Browse files
authored
Merge pull request #55 from utPLSQL/feature/version_info
Adding maven and travis build number
2 parents bfd4364 + 7256c6c commit 04fa93d

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ before_deploy:
5555

5656
deploy:
5757
- provider: script
58-
script: mvn clean deploy -DskipTests=true -B -U
58+
script: mvn clean deploy -DskipTests=true -B -U -DtravisBuildNumber=$TRAVIS_BUILD_NUMBER
5959
skip_cleanup: true
6060
on:
6161
repository: utPLSQL/utPLSQL-java-api
@@ -64,7 +64,7 @@ deploy:
6464
condition: "${TRAVIS_JOB_NUMBER} =~ \\.1$"
6565

6666
- provider: script
67-
script: mvn clean deploy -DskipTests=true -B -U
67+
script: mvn clean deploy -DskipTests=true -B -U -DtravisBuildNumber=$TRAVIS_BUILD_NUMBER
6868
skip_cleanup: true
6969
on:
7070
repository: utPLSQL/utPLSQL-java-api

pom.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<coverage.resources.version>1.0.1</coverage.resources.version>
2121
<coverage.resources.zip.directory>utPLSQL-coverage-html-${coverage.resources.version}</coverage.resources.zip.directory>
2222
<coverage.resources.zip>${coverage.resources.zip.directory}.zip</coverage.resources.zip>
23+
<travisBuildNumber>local</travisBuildNumber>
2324
</properties>
2425

2526
<dependencies>
@@ -128,6 +129,41 @@
128129
</execution>
129130
</executions>
130131
</plugin>
132+
<plugin>
133+
<groupId>com.google.code.maven-replacer-plugin</groupId>
134+
<artifactId>replacer</artifactId>
135+
<version>1.5.3</version>
136+
<executions>
137+
<execution>
138+
<id>replace-version-number</id>
139+
<phase>generate-sources</phase>
140+
<goals>
141+
<goal>replace</goal>
142+
</goals>
143+
</execution>
144+
</executions>
145+
<configuration>
146+
<basedir>${project.basedir}/src/main/java</basedir>
147+
<includes>
148+
<include>**/JavaApiVersionInfo.java</include>
149+
</includes>
150+
<preserveDir>true</preserveDir>
151+
<replacements>
152+
<replacement>
153+
<token>MAVEN_PROJECT_NAME = ".*"</token>
154+
<value>MAVEN_PROJECT_NAME = "${project.name}"</value>
155+
</replacement>
156+
<replacement>
157+
<token>MAVEN_PROJECT_VERSION = ".*"</token>
158+
<value>MAVEN_PROJECT_VERSION = "${project.version}"</value>
159+
</replacement>
160+
<replacement>
161+
<token>BUILD_NO = ".*"</token>
162+
<value>BUILD_NO = "${travisBuildNumber}"</value>
163+
</replacement>
164+
</replacements>
165+
</configuration>
166+
</plugin>
131167
<plugin>
132168
<artifactId>maven-resources-plugin</artifactId>
133169
<version>2.6</version>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.utplsql.api;
2+
3+
/** This class is getting updated automatically by the build process.
4+
* Please do not update its constants manually cause they will be overwritten.
5+
*
6+
* @author pesse
7+
*/
8+
public class JavaApiVersionInfo {
9+
10+
private static final String BUILD_NO = "123";
11+
private static final String MAVEN_PROJECT_NAME = "utPLSQL-java-api";
12+
private static final String MAVEN_PROJECT_VERSION = "3.1.1-SNAPSHOT";
13+
14+
public static String getVersion() {
15+
return MAVEN_PROJECT_VERSION + "." + BUILD_NO;
16+
}
17+
18+
}

0 commit comments

Comments
 (0)