On 02/01/2011 10:23 PM, Wayne Fay wrote:
How do I access the maven version from my java code.
For what purpose, exactly? Are you building a Maven plugin, or simply
building some Java project with Maven?
I have done this by reading version number during runtime from
MANIFEST.MF file:
import java.util.jar.Attributes;
import java.util.jar.Manifest;
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();
}
String version = getAttribute(manifest, "Implementation-Version");
Just curious if this solution is ok or exists better one?
Thanks, Martin Schayna.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]