maven项目pom文件(4)-完整的示例

来源:互联网 发布:怎样下载办公室软件 编辑:程序博客网 时间:2024/06/03 04:18

1、打包之前首先确认项目依赖的包在资源库中

<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>wusc.edu.common</groupId>        <artifactId>edu-common-parent</artifactId>        <version>1.0-SNAPSHOT</version>        <relativePath>../edu-common-parent</relativePath>    </parent>    <groupId>wusc.edu.service</groupId>    <artifactId>edu-service-user</artifactId>    <version>${edu-service-user.version}</version>    <packaging>jar</packaging>    <name>edu-service-user</name>    <url>http://maven.apache.org</url>    <properties>        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>        <log4j.leve>debug</log4j.leve>        <log4j.ale>debug</log4j.ale>    </properties>    <build>        <finalName>edu-service-user</finalName>        <resources>            <resource>                <targetPath>${project.build.directory}/classes</targetPath>                <directory>src/main/resources</directory>                <filtering>true</filtering>                <includes>                    <include>**/*.xml</include>                    <include>**/*.properties</include>                </includes>            </resource>            <!-- 整合dubbo框架采用结合com.alibaba.dubbo.container.Main -->            <resource>                <targetPath>${project.build.directory}/classes/META-INF/spring</targetPath>                <directory>src/main/resources/spring</directory>                <filtering>true</filtering>                <includes>                    <include>spring-context.xml</include>                </includes>            </resource>        </resources>        <plugins>             <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-jar-plugin</artifactId>                <configuration>                    <classesDirectory>${project.build.directory}/classes/</classesDirectory>                    <archive>                        <manifest>                            <!-- 应用的main class -->                            <mainClass>com.alibaba.dubbo.container.Main</mainClass>                            <!-- 打包时 MANIFEST.MF文件不记录的时间戳版本 -->                            <useUniqueVersions>false</useUniqueVersions>                              <!--                                                                                              是否要把第三方jar放到manifest的classpath中                             -->                            <addClasspath>true</addClasspath>                             <!--2、第二步生成的manifest中classpath的前缀,因为要把第三方jar放到lib目录下,所以classpath的前缀是lib/,由META-INF/MANIFEST.MF进行管理                                                                                                                  -->                            <classpathPrefix>lib/</classpathPrefix>                         </manifest>                        <manifestEntries>                            <Class-Path>.</Class-Path>                        </manifestEntries>                    </archive>                </configuration>                          </plugin>             <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-dependency-plugin</artifactId>                <executions>                    <execution>                        <id>copy-dependencies</id>                        <phase>package</phase>                        <goals>                            <goal>copy-dependencies</goal>                        </goals>                        <configuration>                            <type>jar</type>                            <includeTypes>jar</includeTypes>                            <useUniqueVersions>false</useUniqueVersions>                            <outputDirectory>                                ${project.build.directory}/lib  <!--1、第1步将所打jar包的依赖包到copy指定的位置-->                            </outputDirectory>                        </configuration>                    </execution>                </executions>            </plugin>        </plugins>        <pluginManagement>            <plugins>                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->                <plugin>                    <groupId>org.eclipse.m2e</groupId>                    <artifactId>lifecycle-mapping</artifactId>                    <version>1.0.0</version>                    <configuration>                        <lifecycleMappingMetadata>                            <pluginExecutions>                                <pluginExecution>                                    <pluginExecutionFilter>                                        <groupId>                                            org.apache.maven.plugins                                        </groupId>                                        <artifactId>                                            maven-dependency-plugin                                        </artifactId>                                        <versionRange>                                            [2.1,)                                        </versionRange>                                        <goals>                                            <goal>                                                copy-dependencies                                            </goal>                                        </goals>                                    </pluginExecutionFilter>                                    <action>                                        <ignore></ignore>                                    </action>                                </pluginExecution>                            </pluginExecutions>                        </lifecycleMappingMetadata>                    </configuration>                </plugin>            </plugins>        </pluginManagement>    </build>    <dependencies>       <dependency>            <groupId>wusc.edu.common</groupId>            <artifactId>edu-common</artifactId>            <version>${edu-common.version}</version>        </dependency>        <dependency>            <groupId>wusc.edu.common</groupId>            <artifactId>edu-common-config</artifactId>            <version>${edu-common-config.version}</version>        </dependency>        <dependency>            <groupId>wusc.edu.common</groupId>            <artifactId>edu-common-core</artifactId>            <version>${edu-common-core.version}</version>        </dependency>        <dependency>            <groupId>wusc.edu.facade</groupId>            <artifactId>edu-facade-user</artifactId>            <version>${edu-facade-user.version}</version>        </dependency>                <!-- Common Dependency Begin -->        <dependency>            <groupId>antlr</groupId>            <artifactId>antlr</artifactId>        </dependency>        <dependency>            <groupId>aopalliance</groupId>            <artifactId>aopalliance</artifactId>        </dependency>        <dependency>            <groupId>org.aspectj</groupId>            <artifactId>aspectjweaver</artifactId>        </dependency>        <dependency>            <groupId>cglib</groupId>            <artifactId>cglib</artifactId>        </dependency>        <dependency>            <groupId>net.sf.json-lib</groupId>            <artifactId>json-lib</artifactId>            <classifier>jdk15</classifier>            <scope>compile</scope>        </dependency>        <dependency>            <groupId>ognl</groupId>            <artifactId>ognl</artifactId>        </dependency>        <dependency>            <groupId>oro</groupId>            <artifactId>oro</artifactId>        </dependency>        <dependency>            <groupId>commons-beanutils</groupId>            <artifactId>commons-beanutils</artifactId>        </dependency>        <dependency>            <groupId>commons-codec</groupId>            <artifactId>commons-codec</artifactId>        </dependency>        <dependency>            <groupId>commons-collections</groupId>            <artifactId>commons-collections</artifactId>        </dependency>        <dependency>            <groupId>commons-digester</groupId>            <artifactId>commons-digester</artifactId>        </dependency>        <dependency>            <groupId>commons-fileupload</groupId>            <artifactId>commons-fileupload</artifactId>        </dependency>        <dependency>            <groupId>commons-io</groupId>            <artifactId>commons-io</artifactId>        </dependency>        <dependency>            <groupId>org.apache.commons</groupId>            <artifactId>commons-lang3</artifactId>        </dependency>        <dependency>            <groupId>commons-logging</groupId>            <artifactId>commons-logging</artifactId>        </dependency>        <dependency>            <groupId>commons-validator</groupId>            <artifactId>commons-validator</artifactId>        </dependency>        <dependency>            <groupId>dom4j</groupId>            <artifactId>dom4j</artifactId>        </dependency>        <dependency>            <groupId>net.sf.ezmorph</groupId>            <artifactId>ezmorph</artifactId>        </dependency>        <dependency>            <groupId>javassist</groupId>            <artifactId>javassist</artifactId>        </dependency>        <dependency>            <groupId>jstl</groupId>            <artifactId>jstl</artifactId>        </dependency>        <dependency>            <groupId>javax.transaction</groupId>            <artifactId>jta</artifactId>        </dependency>        <dependency>            <groupId>log4j</groupId>            <artifactId>log4j</artifactId>        </dependency>        <dependency>            <groupId>org.slf4j</groupId>            <artifactId>slf4j-api</artifactId>        </dependency>        <dependency>            <groupId>org.slf4j</groupId>            <artifactId>slf4j-log4j12</artifactId>        </dependency>        <!-- Common Dependency End -->        <!-- Spring Dependency Begin -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-aop</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-aspects</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-beans</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-context</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-context-support</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-core</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-expression</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-instrument</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-instrument-tomcat</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-jdbc</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-jms</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-orm</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-oxm</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-struts</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-test</artifactId>            <scope>test</scope>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-tx</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-web</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-webmvc</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-webmvc-portlet</artifactId>        </dependency>        <!-- Spring Dependency End -->        <!-- MyBatis Dependency Begin -->        <dependency>            <groupId>org.mybatis</groupId>            <artifactId>mybatis</artifactId>        </dependency>        <dependency>            <groupId>org.mybatis</groupId>            <artifactId>mybatis-spring</artifactId>        </dependency>        <!-- MyBatis Dependency End -->        <!-- Struts2 Dependency Begin -->        <dependency>            <groupId>org.apache.struts</groupId>            <artifactId>struts2-json-plugin</artifactId>        </dependency>        <dependency>            <groupId>org.apache.struts</groupId>            <artifactId>struts2-convention-plugin</artifactId>        </dependency>        <dependency>            <groupId>org.apache.struts</groupId>            <artifactId>struts2-core</artifactId>        </dependency>        <dependency>            <groupId>org.apache.struts</groupId>            <artifactId>struts2-spring-plugin</artifactId>        </dependency>        <dependency>            <groupId>org.apache.struts.xwork</groupId>            <artifactId>xwork-core</artifactId>        </dependency>        <!-- Struts2 Dependency End -->        <!-- Others Begin -->        <dependency>            <groupId>org.apache.tomcat</groupId>            <artifactId>servlet-api</artifactId>            <scope>provided</scope>        </dependency>        <dependency>            <groupId>org.apache.tomcat</groupId>            <artifactId>jsp-api</artifactId>            <scope>provided</scope>        </dependency>        <dependency>            <groupId>com.alibaba</groupId>            <artifactId>druid</artifactId>        </dependency>        <dependency>            <groupId>org.jsoup</groupId>            <artifactId>jsoup</artifactId>        </dependency>        <!-- Others End -->        <!-- Mysql Driver Begin -->        <dependency>            <groupId>mysql</groupId>            <artifactId>mysql-connector-java</artifactId>        </dependency>        <!-- Mysql Driver End -->        <!-- dubbo 需要的jar start -->        <dependency>            <groupId>org.jboss.netty</groupId>            <artifactId>netty</artifactId>        </dependency>        <dependency>            <groupId>com.alibaba</groupId>            <artifactId>dubbo</artifactId>            <exclusions>                <exclusion>                    <groupId>org.springframework</groupId>                    <artifactId>spring</artifactId>                </exclusion>            </exclusions>        </dependency>        <dependency>            <groupId>org.apache.zookeeper</groupId>            <artifactId>zookeeper</artifactId>        </dependency>        <dependency>            <groupId>com.101tec</groupId>            <artifactId>zkclient</artifactId>        </dependency>        <!-- dubbo 需要的jar end -->    </dependencies></project>
原创粉丝点击