1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5+ <modelVersion >4.0.0</modelVersion >
6+ <groupId >org.example</groupId >
7+ <artifactId >maven-version-number</artifactId >
8+ <version >1.0-SNAPSHOT</version >
9+
10+ <parent >
11+ <groupId >com.baeldung</groupId >
12+ <artifactId >maven-modules</artifactId >
13+ <version >0.0.1-SNAPSHOT</version >
14+ </parent >
15+
16+ <dependencies >
17+ <dependency >
18+ <groupId >org.junit.jupiter</groupId >
19+ <artifactId >junit-jupiter-api</artifactId >
20+ <version >${junit-jupiter.version} </version >
21+ <scope >test</scope >
22+ </dependency >
23+ <dependency >
24+ <groupId >org.junit.jupiter</groupId >
25+ <artifactId >junit-jupiter-engine</artifactId >
26+ <version >${junit-jupiter.version} </version >
27+ <scope >test</scope >
28+ </dependency >
29+ </dependencies >
30+
31+ <!--
32+ <build>
33+ <resources>
34+ <resource>
35+ <directory>src/main/resources</directory>
36+ <filtering>true</filtering>
37+ </resource>
38+ </resources>
39+ <plugins>
40+ <plugin>
41+ <groupId>org.apache.maven.plugins</groupId>
42+ <artifactId>maven-resources-plugin</artifactId>
43+ <version>${maven-resources-plugin.version}</version>
44+ </plugin>
45+ </plugins>
46+ </build>
47+ -->
48+ <build >
49+ <plugins >
50+ <plugin >
51+ <groupId >org.apache.maven.plugins</groupId >
52+ <artifactId >maven-antrun-plugin</artifactId >
53+ <version >${maven-antrun-plugin.version} </version >
54+ <executions >
55+ <execution >
56+ <id >generate-version-file</id >
57+ <phase >generate-resources</phase >
58+ <goals >
59+ <goal >run</goal >
60+ </goals >
61+ <configuration >
62+ <target >
63+ <echo file =" ${project.build.directory}/output/version.txt" >
64+ Version: ${project.version}
65+ </echo >
66+ </target >
67+ </configuration >
68+ </execution >
69+ </executions >
70+ </plugin >
71+ </plugins >
72+ </build >
73+
74+ <properties >
75+ <maven-antrun-plugin .version>3.0.0</maven-antrun-plugin .version>
76+ <maven-resources-plugin .version>3.2.0</maven-resources-plugin .version>
77+ </properties >
78+ </project >
0 commit comments