maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <>
Subject Re: move data from pom to class or class to pom
Date Fri, 18 Jul 2014 07:17:01 GMT
Hi Karl-Heinz,

Karl Heinz Marbaise wrote:

> 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

nice article ;-)

There's one comment I do not understand though:

> The main disadvantage of this approach is that you can only use the
> Implementation and Specification parts of your MANIFEST.MF file which
> might be enough in some situations but not in all.

You can add all kind of entries to the manifest. You may even overwrite the 
defaults. We use typically:

===================== %< ======================
     <X-Builder>Maven ${maven.version}</X-Builder>
===================== %< ======================

With the $parsedVersion and $maven.version variables provided by the build-
helper plugin.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message