Generate Version from Maven version
diff --git a/.classpath b/.classpath
index c3efd0d..83f26b2 100644
--- a/.classpath
+++ b/.classpath
@@ -6,8 +6,16 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry including="**/*.java" kind="src" path="src/main/resources"/>
- <classpathentry including="**/*.java" kind="src" path="src/test/resources"/>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
@@ -19,6 +27,16 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="src" output="target/classes" path="target/generated-sources/version">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/pom.xml b/pom.xml
index 5a4ad98..a6932f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -131,9 +131,26 @@
<optional>true</optional>
</dependency>
- </dependencies>
-
+ </dependencies>
+
+ <properties>
+ <version.build.directory>${project.build.directory}/generated-sources/version</version.build.directory>
+ </properties>
+
<build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/Version.java</include>
+ </includes>
+ <filtering>true</filtering>
+ <targetPath>${version.build.directory}</targetPath>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
<plugins>
<!-- Bundle sources -->
@@ -171,6 +188,28 @@
<configuration>
<encoding>UTF-8</encoding>
</configuration>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${version.build.directory}</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
<!-- OSGi manifest creation -->
diff --git a/src/main/java/org/testng/internal/Version.java b/src/main/resources/org/testng/internal/Version.java
similarity index 76%
rename from src/main/java/org/testng/internal/Version.java
rename to src/main/resources/org/testng/internal/Version.java
index f861d9d..ab56291 100644
--- a/src/main/java/org/testng/internal/Version.java
+++ b/src/main/resources/org/testng/internal/Version.java
@@ -1,7 +1,7 @@
package org.testng.internal;
public class Version {
- public static final String VERSION = "6.8.9beta";
+ public static final String VERSION = "${project.version}";
public static void displayBanner() {
System.out.println("...\n... TestNG " + VERSION + " by Cédric Beust (cedric@beust.com)\n...\n");