[RocksJava] MVN Build reads version from version.h

main
fyrz 10 years ago
parent 8a1bcc39c5
commit b8d5e3f08e
  1. 35
      java/rocksjni.pom

@ -8,7 +8,8 @@
<url>http://rocksdb.org/</url>
<groupId>org.rocksdb</groupId>
<artifactId>rocksdbjni</artifactId>
<version>3.8.0</version>
<!-- Version will be automatically replaced -->
<version>-</version>
<description>RocksDB fat jar that contains .so files for linux32 and linux64, and jnilib files
for Mac OSX.
</description>
@ -139,6 +140,38 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<defaults>
<name>Xenu</name>
</defaults>
<source>
String fileContents = new File("${project.basedir}/../include/rocksdb/version.h").getText('UTF-8')
matcher = (fileContents =~ /(?s).*ROCKSDB_MAJOR ([0-9]+).*?/)
String major_version = matcher.getAt(0).getAt(1)
matcher = (fileContents =~ /(?s).*ROCKSDB_MINOR ([0-9]+).*?/)
String minor_version = matcher.getAt(0).getAt(1)
matcher = (fileContents =~ /(?s).*ROCKSDB_PATCH ([0-9]+).*?/)
String patch_version = matcher.getAt(0).getAt(1)
String version = String.format('%s.%s.%s', major_version, minor_version, patch_version)
// Set version to be used in pom.properties
project.version = version
// Set version to be set as jar name
project.build.finalName = project.artifactId + "-" + version
</source>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Loading…
Cancel
Save