Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Put version info in separate textfile and read from that#66

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
pesse merged 1 commit intodevelopfromfeature/outsource_version_info_to_file
Dec 13, 2018
Merged
Show file tree
Hide file tree
Changes fromall 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
51 changes: 16 additions & 35 deletionspom.xml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -134,41 +134,6 @@
</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 DownExpand Up@@ -220,6 +185,22 @@
</dependencies>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/utplsql-api.version</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/utplsql-api.version</exclude>
</excludes>
</resource>
</resources>
</build>

<profiles>
Expand Down
26 changes: 22 additions & 4 deletionssrc/main/java/org/utplsql/api/JavaApiVersionInfo.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
package org.utplsql.api;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;

/** This class is getting updated automatically by the build process.
* Please do not update its constants manually cause they will be overwritten.
*
Expand All@@ -9,13 +17,23 @@ public class JavaApiVersionInfo {

private JavaApiVersionInfo() { }

private static final String BUILD_NO = "123";

private static final String MAVEN_PROJECT_NAME = "utPLSQL-java-api";
private staticfinalString MAVEN_PROJECT_VERSION = "3.1.2-SNAPSHOT";
private static String MAVEN_PROJECT_VERSION = "unknown";

public static String getVersion() {
return MAVEN_PROJECT_VERSION + "." + BUILD_NO;
static {
try {
MAVEN_PROJECT_VERSION = Files.readAllLines(
Paths.get(JavaApiVersionInfo.class.getClassLoader().getResource("utplsql-api.version").toURI())
, Charset.defaultCharset())
.get(0);
}
catch ( IOException | URISyntaxException e ) {
System.out.println("WARNING: Could not get Version information!");
}
}

public static String getVersion() { return MAVEN_PROJECT_VERSION; }
public static String getInfo() { return MAVEN_PROJECT_NAME + " " + getVersion(); }

}
1 change: 1 addition & 0 deletionssrc/main/resources/utplsql-api.version
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
${project.version}.${travisBuildNumber}
13 changes: 13 additions & 0 deletionssrc/test/java/org/utplsql/api/JavaApiVersionTest.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
package org.utplsql.api;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertTrue;

public class JavaApiVersionTest {

@Test
void getJavaApiVersion() {
assertTrue(JavaApiVersionInfo.getVersion().startsWith("3.1"));
}
}

[8]ページ先頭

©2009-2025 Movatter.jp