相关疑难解决方法(0)

如何使用命令行创建WAR文件?

我安装了JBoss Developer Studio,可以通过"鼠标右键项目>导出> WAR文件"创建WAR文件,但我想使用命令行将项目导出到WAR文件.

我安装了maven,这是Studio的一个要求,我读到我可以使用maven生成一个WAR文件,但我需要一个名为pom.xml的文件.当我搜索我的工作区和项目时,pom.xml丢失了.我可能需要手动创建pom.xml但我不确定如何.

我项目的目录树如下:

Siesta
??? build
?   ??? classes
??? src
??? WebContent
    ??? extjs
    ??? extjs-4.2.0
    ??? extjs-4.2.2
    ??? index.jsp
    ??? META-INF
    ??? siesta
    ??? tests
    ??? WEB-INF
Run Code Online (Sandbox Code Playgroud)

如何使用命令行为Maven/JBoss项目创建WAR文件?我使用Linux并且不想创建pom.xml文件,但如果没有其他方法,那么我将使用xml文件生成war文件.

编辑:

所以jar是创建war文件的方法.我写了一个小脚本,它将为我创建一个特定目录的war文件.

#!/bin/bash
cd Siesta/WebContent/
jar -cvf ../../Siesta.war *
cd -
Run Code Online (Sandbox Code Playgroud)

然后,如果您在ubuntu中的zip实用程序或归档管理器中打开war文件,您将看到此结构

    ??? extjs
    ??? extjs-4.2.0
    ??? extjs-4.2.2
    ??? index.jsp
    ??? META-INF
    ??? siesta
    ??? tests
    ??? WEB-INF
Run Code Online (Sandbox Code Playgroud)

我必须将CD放入我想要创建一个令人讨厌的war文件的目录中.我认为使用jar的-C选项可能有更好的方法,但是当我使用"jar -cvf Siesta.war -C Siesta/WebContent*"时,它没有相同的结果.

EDIT2:

jar -cvf my-app.war myfolder/
Run Code Online (Sandbox Code Playgroud)

为了我的应用程序在TomCat上工作,我使用以下内容:

cd Siesta/WebContent
jar -cvf Siesta.war *
Run Code Online (Sandbox Code Playgroud)

jboss war pom.xml maven siesta

13
推荐指数
2
解决办法
4万
查看次数

创建WAR文件时出错

C:\Users\accer\Documents\NetBeansProjects\Scholarshipcrud>jar cf scholarship.war

'c'` flag requires manifest or input files to be specified!
Usage: `jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] fil
es ...
Options:  

-c  create new archive
-t  list table of contents for archive
-x  extract named (or all) files from archive
-u  update existing archive
-v  generate verbose output on standard output
-f  specify archive file name
-m  include manifest information from specified manifest file
-e  specify application entry point for stand-alone application
    bundled into an executable …
Run Code Online (Sandbox Code Playgroud)

java

1
推荐指数
2
解决办法
3526
查看次数

标签 统计

java ×1

jboss ×1

maven ×1

pom.xml ×1

siesta ×1

war ×1