我需要知道如何使用Ubuntu系统中的“终端”应用程序创建war文件。应该执行什么命令以及在定义路径/目标文件夹后应该遵循哪些步骤
这是我的POM文件内容
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.erp</groupId>
<artifactId>erp-web</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>erp-web Maven Webapp</name>
<url>http://maven.apache.org</url>
<!-- Shared version number properties -->
<properties>
<org.springframework.version>3.0.5.RELEASE</org.springframework.version>
</properties>
<dependencies>
<!-- Backend API project -->
<dependency>
<groupId>com.erp</groupId>
<artifactId>erp</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-servlet</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-extras</artifactId>
<version>2.2.2</version>
</dependency>
<!-- Web application development utilities applicable to both Servlet and
Portlet Environments (depends on spring-core, spring-beans, spring-context)
Define this if you use Spring MVC, or wish to use Struts, JSF, or another
web framework with Spring (org.springframework.web.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- Spring MVC for Servlet Environments (depends on spring-core, spring-beans,
spring-context, spring-web) Define this if you use Spring MVC with a Servlet
Container such as Apache Tomcat (org.springframework.web.servlet.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- Spring MVC for Portlet Environments (depends on spring-core, spring-beans,
spring-context, spring-web) Define this if you use Spring MVC with a Portlet
Container (org.springframework.web.portlet.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.0</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.4.3</version>
</dependency>
</dependencies>
<build>
<finalName>mycode</finalName>
</build>
</project>
当我运行Maven命令(mvn clean install)时出现此错误
Missing:
----------
1) com.erp:erp:jar:1.0-SNAPSHOT
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.erp -DartifactId=erp -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.erp -DartifactId=erp -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) com.erp:erp-web:war:1.0-SNAPSHOT
2) com.erp:erp:jar:1.0-SNAPSHOT
----------
1 required artifact is missing.
for artifact:
com.erp:erp-web:war:1.0-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
答案 0 :(得分:0)
在项目路径下,$ jar -cvf YOUR_WAR.war *
应该执行这些操作(使用javac
命令进行文件编译之后),您可以使用逗号,
替换自定义文件目标。
但是我强烈建议使用构建/打包工具,例如Apache Maven或Ant。 使用maven,您可以使用mave-war-plugin生成Web存档,对于Apache Ant,您可以使用war build sample。
BR。
答案 1 :(得分:0)
我有点担心以下依赖,因为所有其他人似乎都很熟悉: com.erp erp 1.0-SNAPSHOT 这是你自己开发的cutom项目吗? 然后,您应该将此原型安装到本地存储库中。