Skip to content

Commit 6a73e2f

Browse files
committed
refactoring
1 parent 0967d7e commit 6a73e2f

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

jcp/src/main/java/com/igormaznitsa/jcp/InfoHelper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public final class InfoHelper {
4545

4646
public static final String VERSION;
4747
public static final String URL;
48+
public static final int YEAR;
4849

4950
static {
5051
final String path = "/jcpversion.props";
@@ -53,6 +54,7 @@ public final class InfoHelper {
5354
props.load(stream);
5455
VERSION = Objects.requireNonNull(props.getProperty("version"));
5556
URL = Objects.requireNonNull(props.getProperty("url"));
57+
YEAR = Integer.parseInt(Objects.requireNonNull(props.getProperty("year")).trim());
5658
} catch (IOException ex) {
5759
throw new Error("Can't read resource: " + path, ex);
5860
}
@@ -67,7 +69,7 @@ public static String getVersion() {
6769

6870

6971
public static String getCopyright() {
70-
return "Copyright (C) 2002-2024 Igor A. Maznitsa (https://www.igormaznitsa.com)";
72+
return "Copyright (C) 2002-" + YEAR + " Igor A. Maznitsa (https://www.igormaznitsa.com)";
7173
}
7274

7375

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
version=${project.version}
22
url=${project.url}
3+
year=${current.year}

pom.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@
157157
<artifactId>maven-shade-plugin</artifactId>
158158
<version>3.3.0</version>
159159
</plugin>
160+
<plugin>
161+
<groupId>org.codehaus.mojo</groupId>
162+
<artifactId>build-helper-maven-plugin</artifactId>
163+
<version>3.0.0</version>
164+
</plugin>
160165
</plugins>
161166
</pluginManagement>
162167
<plugins>
@@ -207,6 +212,23 @@
207212
</dependency>
208213
</dependencies>
209214
</plugin>
215+
<plugin>
216+
<groupId>org.codehaus.mojo</groupId>
217+
<artifactId>build-helper-maven-plugin</artifactId>
218+
<executions>
219+
<execution>
220+
<id>timestamp-property</id>
221+
<goals>
222+
<goal>timestamp-property</goal>
223+
</goals>
224+
<phase>validate</phase>
225+
<configuration>
226+
<name>current.year</name>
227+
<pattern>yyyy</pattern>
228+
</configuration>
229+
</execution>
230+
</executions>
231+
</plugin>
210232
</plugins>
211233
</build>
212234
</project>

0 commit comments

Comments
 (0)