如何生成.war文件。我有一个JS应用程序,其文件夹结构为
appname-带文件夹
---- bower_components
---- CSS
---- DIST
---- HTTP服务器
----图像
---- JS
----以下
---- node_modules
----页
---- scritps
----的index.html
答案 0 :(得分:0)
您可以使用maven生成一个空项目,然后添加您的内容。
首先按照以下步骤操作,在第一个命令类型“maven-archetype-webapp”,即您正在使用的原型名称。
$ mvn archetype:generate
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: remote -> am.ik.archetype:maven-reactjs-blank-archetype (Blank Project for React.js)
2: remote -> am.ik.archetype:msgpack-rpc-jersey-blank-archetype (Blank Project for Spring Boot + Jersey)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 943: maven-archetype-webapp
Choose archetype:
1: remote -> org.apache.maven.archetypes:maven-archetype-webapp (An archetype which contains a sample Maven Webapp project.)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
Choose org.apache.maven.archetypes:maven-archetype-webapp version:
1: 1.0-alpha-1
2: 1.0-alpha-2
3: 1.0-alpha-3
4: 1.0-alpha-4
5: 1.0
Choose a number: 5: 5
Define value for property 'groupId': : com.greg
Define value for property 'artifactId': : mywebapp
Define value for property 'version': 1.0-SNAPSHOT: :
Define value for property 'package': com.greg: :
Confirm properties configuration:
groupId: com.greg
artifactId: mywebapp
version: 1.0-SNAPSHOT
package: com.greg
Y: :
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-webapp:1.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: basedir, Value: C:\work
[INFO] Parameter: package, Value: com.greg
[INFO] Parameter: groupId, Value: com.greg
[INFO] Parameter: artifactId, Value: mywebapp
[INFO] Parameter: packageName, Value: com.greg
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: C:\work\mywebapp
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:34 min
[INFO] Finished at: 2017-03-27T11:44:07+01:00
[INFO] Final Memory: 14M/159M
[INFO] ------------------------------------------------------------------------
然后,您可以将项目的内容复制到mywebapp / src / main / webapp
然后你可以mvn clean install,你将在目标文件夹中有一个war文件。