Hi,

> Move the Java code that should contain the version into an own directory
tree (e.g. src/main/java-templates). Replace the version string with an
expression (e.g. "${project.version}") and use the copy-resources goal of
the resources plugin to filter the file into a target driectory tree (e.g.
target/generated-sources). Bind the goal to the generate-sources phase. Then
use additionally the build-helper plugin to add target/generated-sources as
additional source directory and you're done.

Best solution was already mentoined by Robert Scholte by using the templating-maven-plugin which exactly supports that scenario without supplemental addition of target/generated-sources folder by build-helpr-maven-plugin etc.

Just simply create the template files in src/main/java-templates/ use the expressions etc. no need for supplemental configuration of maven-resources-plugin etc.

Best and simple solution...which i wrote longer time a go a blog about
http://blog.soebes.de/blog/2014/01/02/version-information-into-your-appas-with-maven/

Kind regards
Karl-Heinz Marbaise

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to