如何解包和重新打包 WAR 文件 [英] How to unpackage and repackage a WAR file

查看:111
本文介绍了如何解包和重新打包 WAR 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 WAR 文件.我想打开它,编辑一个 XML 文件,删除一些 jar,然后重新打包.

I have a WAR file. I would like to open it, edit an XML file, remove some jars and then re-package it.

我使用 WINRAR 打开 WAR 文件并删除了一些 Jars 并在 WinRar 中执行了添加到存档"并创建了一个 WAR.

I used WINRAR to open the WAR file and I removed some Jars and did an 'Add to Archive' in WinRar and created a WAR.

当我在 jboss 文件夹中部署 WAR 时,出现异常.

When I deployed the WAR in jboss folder, I got an exception.

   16:05:14,316 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) 
   MSC00001: Failed to start service jboss.deployment.unit."myapplication.war".
   STRUCTURE: org.jboss.msc.service.StartException in 
   service   jboss.deployment.unit."myapplication.war".STRUCTURE: 
   Failed to process phase STRUCTURE of deployment "myapplication.war"

如何重新打包 WAR ?

How do I repackage the WAR ?

推荐答案

你可以使用这里提到的 java 命令从命令行更新你的战争:

you can update your war from the command line using java commands as mentioned here:

jar -uvf test.war yourclassesdir 

其他有用的命令:

解压/分解war文件的命令

Command to unzip/explode the war file

jar -xvf test.war

创建war文件的命令

jar -cvf test.war yourclassesdir 

例如:

jar -cvf test.war *
jar -cvf test.war WEB-INF META-INF

这篇关于如何解包和重新打包 WAR 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆