It has nothing to do with Wicket but Maven.

Anyway, I use this config on maven-jar-plugin which inserts "Implementation-Version" attribute into manifest:

<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3</version>
<configuration>
<archive>
<manifest>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</manifestEntries>
</archive>
</configuration>
</plugin>

and read version from manifest with this code:

    public static String getApplicationVersion() {
        WebApplication app = WebApplication.get();
Manifest manifest = (Manifest)app.getServletContext().getAttribute("MANIFEST");
        if (manifest == null) {
            try {
manifest = new Manifest(app.getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF"));
            } catch (Exception e) {
                manifest = new Manifest();
            }
        }
        return getAttribute(manifest, "Implementation-Version");
    }

    private static String getAttribute(Manifest manifest, String name) {
        if (manifest.getMainAttributes() == null)
            return "";
        Attributes.Name attName = new Attributes.Name(name);
        if (manifest.getMainAttributes().get(attName) != null)
            return manifest.getMainAttributes().get(attName).toString();
        else
            return "";
    }

HTH

Martin Schayna


On 12/14/2011 11:45 AM, Sjoerd Schunselaar wrote:
That is the Wicket version, I mean the version of my project which can be
set in the pom file.


     <modelVersion>4.0.0</modelVersion>
     <groupId>nl.sjoerd.test</groupId>
     <artifactId>projectx</artifactId>
     <version>0.0.6</version>
     <packaging>war</packaging>
     <name>projectx</name>

Kind regards,

Sjoerd Schunselaar


On Wed, Dec 14, 2011 at 11:37 AM, Ernesto Reinaldo Barreiro<
[email protected]>  wrote:

Application.getFrameworkSettings().getVersion()?


On Wed, Dec 14, 2011 at 11:33 AM, Sjoerd Schunselaar<
[email protected]>  wrote:

Hi all,

Is there a easy way to display the artifact version which can be set in
de
maven pom.xml file?
I would like to display that artifact version in the title bar.


met vriendelijke groet,

Sjoerd Schunselaar


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

Reply via email to