Skip to content

Commit 34f3e41

Browse files
Remove the need to generate Constants.java, can grab the project version from the java class itself
1 parent d486cdb commit 34f3e41

File tree

3 files changed

+1
-25
lines changed

3 files changed

+1
-25
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,3 @@ bin/
2626
## VSCode
2727
.vscode/
2828
.devcontainer/
29-
30-
## build generated file
31-
grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/util/Constants.java

build.gradle

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,6 @@ ext {
7272
buildRevision = versioning.info.commit
7373
}
7474

75-
task createConstantsFile(type: Copy) {
76-
from("grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/util/Constants.java.template") {
77-
rename "Constants.java.template", "Constants.java"
78-
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
79-
versionStringPlaceholder: "v${projectVersion}".toString(),
80-
])
81-
}
82-
into "grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/util"
83-
}
84-
clean.doFirst {
85-
delete "grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/util/Constants.java"
86-
}
87-
8875
allprojects {
8976
apply plugin: 'java'
9077
apply plugin: 'idea'
@@ -147,12 +134,8 @@ allprojects {
147134
include 'LICENSE'
148135
into 'META-INF'
149136
}
150-
dependsOn createConstantsFile
151137
}
152138

153-
compileJava.dependsOn createConstantsFile
154-
spotlessJava.dependsOn createConstantsFile
155-
156139
// Generate MANIFEST.MF
157140
jar {
158141
manifest {
@@ -241,10 +224,6 @@ allprojects { project ->
241224
}
242225
}
243226

244-
delombok {
245-
dependsOn createConstantsFile
246-
}
247-
248227
// Javadoc Task
249228
javadoc {
250229
dependsOn delombok
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public final class Constants {
2424
/**
2525
* A constant that defines the current version of the library.
2626
*/
27-
public static final String VERSION = "@versionStringPlaceholder@";
27+
public static final String VERSION = Constants.class.getPackage().getImplementationVersion();
2828

2929

3030
/**

0 commit comments

Comments
 (0)