Friday 15 January 2010

java - How to read manifest.mf from *.war/META-INF/MANIFEST.MF file? -



java - How to read manifest.mf from *.war/META-INF/MANIFEST.MF file? -

using maven compiled *.war file, contains:

- meta-inf - - manifest.mf - web-inf - - classes - - lib - - web.xml

using java.util.jar.manifest want read manifest file application version there in http://stackoverflow.com/a/21046257/1728511

but application.class.getresourceasstream("/meta-inf/manifest.mf") returns null.

application.class.getresource( "" ).getfile() returns %war%/web-inf/lib/javax.ws.rs-api-2.0.jar!/javax/ws/rs/core/

using spring, i've implemented applicationcontextaware interface applicationcontext instance.

and applicationcontext.getclassloader().getresourceasstream( "" ) returns %war%/web-inf/classes.

but don't need web-inf, need meta-inf directory. how it?

you mixing cases. meta-inf contains manifest.mf trying open resource stream on manifest.mf.

you have change

application.class.getresourceasstream("/meta-inf/manifest.mf")

to

application.class.getresourceasstream("/meta-inf/manifest.mf")

java spring maven web-applications

No comments:

Post a Comment