maven创建web项目

为啥本页面不支持贴图?


术语:

GroupID:项目组织唯一的标识符,实际对应JAVA的包的结构,是main目录里java的目录结构。

ArtifactID:项目的唯一的标识符,实际对应项目的名称,就是项目根目录的名称。


步骤:

1.创建主项目



见附件图-1、2、3


创建完成后的目录结构(届时会删除src目录)


2.创建普通项目模块


见附件图-4、5、6、7


3.创建web模块


见附件图-8、9、10



4.创建完成后的项目及所有相关模块结构图

见附件图-11



5.为项目添加依赖的jar包

<?xml version="1.0" encoding="UTF-8"?>
<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>
  <groupId>com.yshh.o2o</groupId>
  <artifactId>o2o-ms</artifactId>
  <version>0.1.0-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>o2o-ms</name>
  <description>message system contains email and short message</description>
  <url>http://maven.apache.org</url>
  <modules>
    <module>o2o-ms-common</module>
    <module>o2o-ms-common-api</module>
    <module>o2o-ms-dal</module>
    <module>o2o-ms-service</module>
    <module>o2o-ms-manager</module>
    <module>o2o-ms-web</module>
  </modules>
  
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <spring.version>3.1.4.RELEASE</spring.version>
	<base.version>0.9.7-SNAPSHOT</base.version>
  </properties>
  <distributionManagement>
    <repository>
      <id>releases</id>
      <name>yshh Releases</name>
      <url>http://10.0.30.57:8081/nexus/content/repositories/releases</url>
    </repository>
    <snapshotRepository>
      <id>snapshots</id>
      <name>yshh Snapshots</name>
      <url>http://10.0.30.57:8081/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>
  
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <version>${spring.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
          <encoding>${project.build.sourceEncoding}</encoding>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.1.2</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>verify</phase>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

6.其它pom

你可能感兴趣的:(maven创建web项目)