Skip to content

Adding maven and travis build number #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ before_deploy:

deploy:
- provider: script
script: mvn clean deploy -DskipTests=true -B -U
script: mvn clean deploy -DskipTests=true -B -U -DtravisBuildNumber=$TRAVIS_BUILD_NUMBER
skip_cleanup: true
on:
repository: utPLSQL/utPLSQL-java-api
Expand All @@ -64,7 +64,7 @@ deploy:
condition: "${TRAVIS_JOB_NUMBER} =~ \\.1$"

- provider: script
script: mvn clean deploy -DskipTests=true -B -U
script: mvn clean deploy -DskipTests=true -B -U -DtravisBuildNumber=$TRAVIS_BUILD_NUMBER
skip_cleanup: true
on:
repository: utPLSQL/utPLSQL-java-api
Expand Down
36 changes: 36 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<coverage.resources.version>1.0.1</coverage.resources.version>
<coverage.resources.zip.directory>utPLSQL-coverage-html-${coverage.resources.version}</coverage.resources.zip.directory>
<coverage.resources.zip>${coverage.resources.zip.directory}.zip</coverage.resources.zip>
<travisBuildNumber>local</travisBuildNumber>
</properties>

<dependencies>
Expand Down Expand Up @@ -128,6 +129,41 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<id>replace-version-number</id>
<phase>generate-sources</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<basedir>${project.basedir}/src/main/java</basedir>
<includes>
<include>**/JavaApiVersionInfo.java</include>
</includes>
<preserveDir>true</preserveDir>
<replacements>
<replacement>
<token>MAVEN_PROJECT_NAME = ".*"</token>
<value>MAVEN_PROJECT_NAME = "${project.name}"</value>
</replacement>
<replacement>
<token>MAVEN_PROJECT_VERSION = ".*"</token>
<value>MAVEN_PROJECT_VERSION = "${project.version}"</value>
</replacement>
<replacement>
<token>BUILD_NO = ".*"</token>
<value>BUILD_NO = "${travisBuildNumber}"</value>
</replacement>
</replacements>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/org/utplsql/api/JavaApiVersionInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.utplsql.api;

/** This class is getting updated automatically by the build process.
* Please do not update its constants manually cause they will be overwritten.
*
* @author pesse
*/
public class JavaApiVersionInfo {

private static final String BUILD_NO = "123";
private static final String MAVEN_PROJECT_NAME = "utPLSQL-java-api";
private static final String MAVEN_PROJECT_VERSION = "3.1.1-SNAPSHOT";

public static String getVersion() {
return MAVEN_PROJECT_VERSION + "." + BUILD_NO;
}

}