Java packaging file types
JAR - Java Archive
WAR - Web Archive
EAR - Enterprise Archive. For assembling Java EE modules.
A WAR or EAR file is a standard JAR file with a .war or .ear extension. They are all for assembling or packaging components or modules.
An EAR file contains (or assembles) Java EE modules (JARs and WARs) and, optionally, deployment descriptors inside META-INF. There're two types of deployment descriptors, Java EE (application.xml) and runtime (specified by application server).
Enterprise Application MAVEN Project Creation
Create a enterprise application maven project which contains only one Java Web Application (WAR).
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.martian.wbbank</groupId>
<artifactId>wbbank-root</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<groupId>com.martian.wbbank.interfacelayer</groupId>
<artifactId>wbbank-spring-ear</artifactId>
<packaging>ear</packaging>
<name>wbbank-spring-ear</name>
<dependencies>
<dependency>
<groupId>com.martian.wbbank.interfacelayer</groupId>
<artifactId>wbbank-spring</artifactId>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10</version>
<configuration>
<modules>
<webModule>
<groupId>com.martian.wbbank.interfacelayer</groupId>
<artifactId>wbbank-spring</artifactId>
<strong><contextRoot>/wbbank</contextRoot></strong>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>*** We also modify the context root of this web application instead of default value.
本文指导如何使用Maven创建并配置企业级应用项目,包含创建仅包含JavaWeb应用(WAR)的企业应用Maven项目,以及相关依赖、打包方式和上下文根配置。
8215

被折叠的 条评论
为什么被折叠?



