maven - Windows Batch script to read pom.properties file within .jar -


i'm looking simple way read 2nd line of pom.properties file placed within meta-inf folder of compiled .jar. (see here: http://maven.apache.org/guides/getting-started/index.html#how_do_i_add_resources_to_my_jar). need know date in file , it's pain have open jar every time , dig down it. want windows batch script can run via right-clicking on .jar (so i'll need windows registry command well). result of batch command can displayed in cmd window (a nice bonus value being copied clipboard, too).

in short: want able right-click on .jar file in windows explorer > select 'get maven generated date' (or whatever) > , have 2nd line of pom.properties file printed console (and copied clipboard).

i know can't hard, don't know quite :).

thanks in advance help.

note .netv4.5 required use system.io.compression.filesystem class.

add-type -as system.io.compression.filesystem;  $sourcejar = <source-jar-here>; $jararchive = [io.compression.zipfile]::openread($sourcejar).entries try {     foreach($archiveentry in $jararchive)     {         if($archiveentry.name -like "*pom.properties")         {             $tempfile = [system.io.path]::gettempfilename()             try             {                 [system.io.compression.zipfileextensions]::extracttofile($archiveentry, $tempfile, $true)                 $mavendate = get-content $tempfile -first 2                 write-host $mavendate             }                         {                 remove-item $tempfile             }         }     } } {     $jararchive.dispose } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -