zoukankan      html  css  js  c++  java
  • Maven实战(八)pom.xml简介

      目录

    pom作为项目对象模型。通过xml表示maven项目,使用pom.xml来实现。主要描述了项目:包括配置文件、开发者需要遵循的规则、缺陷管理系统、组织和licenses、项目的url、项目的依赖性以及其他所有的项目相关因素。

    下面是我在项目中应用的一个pom.xml,仅供参考

    更多细节内容将在后面的章节中一一讲解

    <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>
        <!-- 继承父类 -->
        <parent>
            <!-- 坐标 -->
            <groupId>com.shiyue.sysesp</groupId>
            <artifactId>sysesp-core-parent</artifactId>
            <version>1.0.CR11</version>
            <relativePath>../sysesp-core-parent/pom.xml</relativePath>
        </parent>
        <artifactId>sysesp-core-web</artifactId>
        <!-- jar/war/ear -->
        <packaging>war</packaging>
        <url>http://maven.apache.org</url>
                                                          
        <!-- 依赖jar包 -->
        <dependencies>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.shiyue.sysesp</groupId>
                <artifactId>sysesp-core-service</artifactId>
            </dependency>
            <!-- Struts2.3.4 -->
            <dependency>
                <groupId>org.apache.struts</groupId>
                <artifactId>struts2-core</artifactId>
            </dependency>
            <dependency>
                <groupId>org.apache.struts</groupId>
                <artifactId>struts2-convention-plugin</artifactId>
            </dependency>
            <dependency>
                <groupId>org.apache.struts</groupId>
                <artifactId>struts2-json-plugin</artifactId>
            </dependency>
            <dependency>
                <groupId>org.apache.struts</groupId>
                <artifactId>struts2-spring-plugin</artifactId>
            </dependency>
            <!-- Servlet API -->
            <dependency>
                <groupId>com.shiyuesoft</groupId>
                <artifactId>servlet-api</artifactId>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.shiyuesoft</groupId>
                <artifactId>jsp-api</artifactId>
                <scope>provided</scope>
            </dependency>
            <!-- JSTL -->
            <dependency>
                <groupId>jstl</groupId>
                <artifactId>jstl</artifactId>
            </dependency>
            <!-- Spring web -->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
            </dependency>
            <dependency>
                <groupId>jxl</groupId>
                <artifactId>jxl</artifactId>
            </dependency>
            <!-- 分页 -->
            <dependency>
                <groupId>com.sysesp.tag</groupId>
                <artifactId>tag</artifactId>
            </dependency>
            <dependency>
                <groupId>org.jasig.cas.client</groupId>
                <artifactId>cas-client-core</artifactId>
            </dependency>
        </dependencies>
                                                          
        <!-- build相关 -->
        <build>
            <!-- 打包后的名称 -->
            <finalName>base</finalName>
                                                              
            <!-- 插件 -->
            <plugins>
                <!-- war包插件 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <configuration>
                      <webResources>
                            <resource>
                                <filtering>true</filtering>
                                <directory>src/main/webapp</directory>
                                <includes>
                                    <include>WEB-INF/web.xml</include>
                                    <include>WEB-INF/log4j.properties</include>
                                </includes>
                            </resource>                  
                        </webResources>
                    </configuration>
                </plugin>
                <!-- 部署插件,自动部署至远程tomcat -->
                <plugin>
                    <groupId>org.apache.tomcat.maven</groupId>
                    <artifactId>tomcat7-maven-plugin</artifactId>
                    <configuration>
                        <url>http://192.168.2.203:8080/manager/text</url>
                        <path>/${build.finalName}</path>
                        <username>bruce</username>
                        <password>bruce</password>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </project>
    作者:风过无痕-唐
    出处:http://www.cnblogs.com/tangyanbo/
    本文以学习、研究和分享为主,欢迎转载,但必须在文章页面明显位置给出原文连接。 如果文中有不妥或者错误的地方还望高手的你指出,以免误人子弟。如果觉得本文对你有所帮助不如【推荐】一下!如果你有更好的建议,不如留言一起讨论,共同进步! 再次感谢您耐心的读完本篇文章。欢迎加QQ讨论群
  • 相关阅读:
    Java实现三人年龄
    从session中获取当前用户的工具类
    全局Session-GlobalSession
    Request获取Session的两种方式
    跨域访问sessionid不一致问题
    获得HttpServletRequest 和HttpSession对象
    eclipse pom.xml 报错org.apache.maven.plugin.war.WarMojo的解决办法
    idea与eclipse项目相互导入的过程
    静态工具类中使用注解注入service实例
    解决静态utils里面注入mapper对象
  • 原文地址:https://www.cnblogs.com/tangyanbo/p/4282063.html
Copyright © 2011-2022 走看看