您的位置:首页 > 编程语言 > Java开发

Myeclipse 创建 Web Maven项目

2016-08-11 13:22 435 查看
1、创建Web项目

  添加Maven支持

  

<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.hi19pay.comm.ctp</groupId>
<artifactId>demo-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<name>demo-parent</name>
<description>19pay comm demo-parent project</description>

<licenses>
<license>
<name>19pay CTPI parent</name>
<url>http://www.19pay.com.cn</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>

<organization>
<name>hi19pay</name>
<url>http://www.19pay.com.cn</url>
</organization>

<developers>
<developer>
<name>jiangzx</name>
<organization>hi19pay</organization>
<organizationUrl>//www.19pay.com.cn</organizationUrl>
<roles>
<role>comm developer</role>
</roles>
<email>jiangzx@19pay.com.cn</email>
</developer>
</developers>

<modules>
<module>demo-util</module>
<module>demo-entity</module>
<module>demo-dao</module>
<module>demo-service</module>
<module>demo-web</module>
</modules>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<springversion>3.0.1.RELEASE-A</springversion>
<junitversion>4.12</junitversion>
</properties>

<build>
<pluginManagement>
<plugins>
<!-- 编译源代码 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<!-- 指定外部lib路径 -->
<extdirs>${project.basedir}/lib</extdirs>
</compilerArguments>
</configuration>
</plugin>

<!-- 打包源代码 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- 生成javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<aggregate>true</aggregate>  <!-- 多模块工程中,将javadoc集中到父工程 -->
<encoding>UTF-8</encoding>
</configuration>
</plugin>

<!-- Test -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<skipTests>true</skipTests>        <!-- 打包过程忽略Junit测试 -->
</configuration>
</plugin>

<!-- 将外部lib一起打成war包 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>${project.basedir}/lib</directory>
<targetPath>WEB-INF/lib</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>

<!-- 生成manifest文件-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>  <!-- 依赖的jar-->
</manifest>
</archive>
</configuration>
</plugin>

<!-- mybatis代码生成工具 -->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<verbose>true</verbose>        <!--允许移动生成的文件-->
<overwrite>true</overwrite>        <!--允许覆盖生成的文件-->
</configuration>
</plugin>

</plugins>
</pluginManagement>
</build>

<distributionManagement>
<repository>
<id>releases</id>
<name>Internal Releases</name>
<url>http://192.168.63.133:9434/nexus/content/repositories/releases/
</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Snapshots</name>
<url>http://192.168.63.133:9434/nexus/content/repositories/snapshots/
</url>
</snapshotRepository>
</distributionManagement>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>

<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.7</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junitversion}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.0</version>
</dependency>

<!-- Apache Commons Codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>

<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>


多模块企业级项目配置实例 pom.xml

  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: