0

I built a Spring Boot web app (using Eclipse/STS) that has an embedded tomcat server.

I need to do some (obfuscation) stuff to classes inside the WAR file and the zip it back up again, but before I try that I'm unzipping and then zipping up again to make sure that will work.

But when I unzip it then zip it back up it won't run anymore ...

Steps to reproduce:

  1. Run the application like so ... java -jar myapp.war ... it works fine. Kill the application.

  2. "Un-zip" the war like so ... jar -xf myapp.war ... all the contents are extracted.

  3. Delete the original war file ... rm myapp.war

  4. "Re-zip" the contents into a war like so ... jar -cfv myapp.war .

  5. Run the new war file ... java -jar myapp.war ... I get an error ...

no main manifest attribute, in myapp.war

When I extract the contents of the new war file, I see that my original /META-INF/MANIFEST.MF file has been replaced by:

Manifest-Version: 1.0
Created-By: 1.7.0_06 (Oracle Corporation)

I'm probably doing something wrong on step (4) above. Any ideas? Is there a "Spring Boot"-specific thing I'm suppose to do?

AvaTaylor
  • 623
  • 4
  • 16

1 Answers1

0

Looks like I figured it out ... I have to use the m option and specify the manifest file like this ...

jar -cfm myapp.war ./META-INF/MANIFEST.MF .

I had incorrectly assumed it would just include the existing manifest file from that directory.

AvaTaylor
  • 623
  • 4
  • 16