Skip to content

Commit e8218e4

Browse files
committed
PackageVersion
1 parent 04db3b5 commit e8218e4

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed

driver/pom.xml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,48 @@
104104

105105
<build>
106106
<plugins>
107+
<plugin>
108+
<groupId>com.google.code.maven-replacer-plugin</groupId>
109+
<artifactId>replacer</artifactId>
110+
<version>1.5.3</version>
111+
<executions>
112+
<execution>
113+
<phase>generate-sources</phase>
114+
<goals>
115+
<goal>replace</goal>
116+
</goals>
117+
</execution>
118+
</executions>
119+
<configuration>
120+
<file>${project.basedir}/src/main/java/com/arangodb/PackageVersion.java.in</file>
121+
<outputFile>${project.build.directory}/generated-sources/replacer/com/arangodb/PackageVersion.java</outputFile>
122+
<replacements>
123+
<replacement>
124+
<!--suppress UnresolvedMavenProperty -->
125+
<token>@project.version@</token>
126+
<value>${project.version}</value>
127+
</replacement>
128+
</replacements>
129+
</configuration>
130+
</plugin>
131+
<plugin>
132+
<groupId>org.codehaus.mojo</groupId>
133+
<artifactId>build-helper-maven-plugin</artifactId>
134+
<version>3.3.0</version>
135+
<executions>
136+
<execution>
137+
<phase>generate-sources</phase>
138+
<goals>
139+
<goal>add-source</goal>
140+
</goals>
141+
<configuration>
142+
<sources>
143+
<source>${project.build.directory}/generated-sources/replacer</source>
144+
</sources>
145+
</configuration>
146+
</execution>
147+
</executions>
148+
</plugin>
107149
<plugin>
108150
<groupId>org.sonatype.plugins</groupId>
109151
<artifactId>nexus-staging-maven-plugin</artifactId>
@@ -375,6 +417,12 @@
375417
<version>2.0.4</version>
376418
<scope>test</scope>
377419
</dependency>
420+
<dependency>
421+
<groupId>ru.lanwen.verbalregex</groupId>
422+
<artifactId>java-verbal-expressions</artifactId>
423+
<version>1.8</version>
424+
<scope>test</scope>
425+
</dependency>
378426
</dependencies>
379427

380428
<dependencyManagement>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.arangodb;
2+
3+
/**
4+
* Automatically generated from PackageVersion.java.in by replacer plugin.
5+
*/
6+
public final class PackageVersion {
7+
public final static String VERSION = "@project.version@";
8+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.arangodb;
2+
3+
import org.junit.jupiter.api.Test;
4+
import ru.lanwen.verbalregex.VerbalExpression;
5+
6+
import static org.assertj.core.api.Assertions.assertThat;
7+
8+
class PackageVersionTest {
9+
10+
@Test
11+
void packageVersion() {
12+
VerbalExpression testRegex = VerbalExpression.regex()
13+
.startOfLine()
14+
// major
15+
.digit().atLeast(1)
16+
.then(".")
17+
// minor
18+
.digit().atLeast(1)
19+
.then(".")
20+
// patch
21+
.digit().atLeast(1)
22+
.maybe("-SNAPSHOT")
23+
.endOfLine()
24+
.build();
25+
assertThat(PackageVersion.VERSION).matches(testRegex.toString());
26+
}
27+
}

0 commit comments

Comments
 (0)