maven-jar-plugin puts the version into a file

META-INF/maven/groupid/artifactid/pom.properties

have a look... easy to read out...

On Monday 01 October 2007 05:18, Stefano Nichele wrote:
> Hi All,
> is there a way to filter the java source files ? I have a java class
> that contains the version of my application and I would like to set that
> value automatically to the one contained in the pom.
>
> I tried putting in my java file:
>
>     private static final String VERSION = "${project.version}";
>
>
> and modifying my pom in order to have the java files in the resources:
>
> ...
>       <resource>
>         <directory>src/main/java</directory>
>         <filtering>true</filtering>
>         <targetPath>java</targetPath>
>       </resource>
> ...
>
> In this way, under target/generated-sources/java I have my java class
> with the right version, but now I have to compile it.
> I tried setting the sourceDirectory in the build section:
>
> ...
>   <build>
>     <sourceDirectory>target/generated-sources/java</sourceDirectory>
>     <resources>
> ...
>
> but it doesn't work because the compilation is performed before my java
> classes are copied in target/generated-sources/java.
>
> Any hint ?
>
> Thanks in advance
> Ste
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Michael McCallum
Enterprise Engineer
mailto:[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to