maven实际应用
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><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.xuanwu</groupId>
??<artifactId>sxt_mtoserver</artifactId>
??<version>1.0-SNAPSHOT</version>
??<packaging>jar</packaging>
??<name>sxt_mtoserver</name>
??<url>http://maven.apache.org</url>
??<properties>
??????<!--?自定义变量?-->
????<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
????<project.deploy>deploy</project.deploy>
??</properties>
??
??<build>
??????<plugins>
??????????<!--?maven编译插件,指定编译jdk版本???
??????????如果编译目标版本是1.6,然后在1.5虚拟机上运行错误提示Bad?version?number?in?.class?file。所以,如果希望在1.5编译时就发现错误,就要用1.5的编译器-->
??????????<plugin>
??????????????<groupId>org.apache.maven.plugins</groupId>
??????????????<artifactId>maven-compiler-plugin</artifactId>
??????????????<version>2.3.2</version>
??????????????<configuration>
????????????????<source>1.5</source>
????????????????<target>1.5</target>
????????????</configuration>
??????????</plugin>
??????????
??????????<!--?maven打包插件,可执行jar包配置?-->
??????????<!--??
??????????<plugin>
??????????????<groupId>org.apache.maven.plugins</groupId>
??????????????<artifactId>maven-shade-plugin</artifactId>
??????????????<version>1.4</version>
??????????????<executions>
????????????????<execution>
????????????????????<phase>package</phase>
????????????????????<goals>
????????????????????????<goal>shade</goal>
????????????????????</goals>
????????????????????<configuration>
????????????????????????<transformers>
????????????????????????????<transformer
????????????????????????????implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
????????????????????????????<mainClass>com.xuanwu.mtoserver.App</mainClass>
????????????????????????????</transformer>
????????????????????????</transformers>
????????????????????</configuration>
????????????????</execution>
????????????</executions>
??????????</plugin>
??????????-->
??????????
??????????<!--?maven源文件插件?-->
???????????
??????????<plugin>
??????????????<groupId>org.apache.maven.plugins</groupId>
??????????????<artifactId>maven-resources-plugin</artifactId>
??????????????<version>2.5</version>
??????????????<executions>
????????????????????<execution>
????????????????????????<id>copy-resources</id>
????????????????????????<phase>package</phase>
????????????????????????<goals>
????????????????????????????<goal>copy-resources</goal>
????????????????????????</goals>
????????????????????????<configuration>
????????????????????????????<encoding>UTF-8</encoding>
????????????????????????????<outputDirectory>${project.build.directory}/${project.deploy}/conf
????????????????????????????</outputDirectory>
????????????????????????????<resources>
????????????????????????????????<resource>
????????????????????????????????????<directory>src/main/resources/</directory>
????????????????????????????????????<includes>
????????????????????????????????????????<include>*.xml</include>
????????????????????????????????????????<include>*.properties</include>
????????????????????????????????????????<include>*.conf</include>
????????????????????????????????????</includes>
????????????????????????????????</resource>
????????????????????????????</resources>
????????????????????????</configuration>
????????????????????</execution>
????????????????????<execution>
????????????????????????<id>copy-sh</id>
????????????????????????<phase>package</phase>
????????????????????????<goals>
????????????????????????????<goal>copy-resources</goal>
????????????????????????</goals>
????????????????????????<configuration>
????????????????????????????<encoding>UTF-8</encoding>
????????????????????????????<outputDirectory>${project.build.directory}/${project.deploy}/
????????????????????????????</outputDirectory>
????????????????????????????<resources>
????????????????????????????????<resource>
????????????????????????????????????<directory>src/main/resources/</directory>
????????????????????????????????????<includes>
????????????????????????????????????????<include>*.sh</include>
????????????????????????????????????????<include>*.pl</include>
????????????????????????????????????????<include>*.bat</include>
????????????????????????????????????</includes>
????????????????????????????????</resource>
????????????????????????????</resources>
????????????????????????</configuration>
????????????????????</execution>
????????????????</executions>
??????????</plugin>
??????????
??????????
??????????<!--?maven打jar包插件,打包后不包含pom.xml文件?-->
??????????<plugin>
??????????????<groupId>org.apache.maven.plugins</groupId>
??????????????<artifactId>maven-jar-plugin</artifactId>
??????????????<version>2.3.2</version>
??????????????<configuration>?
?????????????????<archive>
?????????????????????<!--?打包后不包括pom的描述文件?-->?
??????????????????????<addMavenDescriptor>false</addMavenDescriptor>
????????????????????<!--?Maven在生成jar时,并不知道这个jar是lib还是app,所以使用以下这个插件告之MAVEN这个jar为app,指定main类?-->?
????????????????????<manifest>????
???????????????????????????<mainClass>com.xuanwu.mtoserver.util.Test</mainClass>????
???????????????????????</manifest>
????????????????</archive>?
?????????????</configuration>
??????????????<executions>
????????????????????<execution>
????????????????????????<id>jarexclude</id>
????????????????????????<phase>package</phase>
????????????????????????<goals>
????????????????????????????<goal>jar</goal>
????????????????????????</goals>
????????????????????????<configuration>
????????????????????????????<outputDirectory>${project.build.directory}/${project.deploy}/lib</outputDirectory>
????????????????????????????<excludes>
????????????????????????????????<exclude>*.xml</exclude>
????????????????????????????????<exclude>*.pl</exclude>
????????????????????????????????<exclude>*.sql</exclude>
????????????????????????????????<exclude>*.properties</exclude>
????????????????????????????????<exclude>*.bat</exclude>
????????????????????????????????<exclude>*.conf</exclude>
????????????????????????????????<exclude>*.sh</exclude>
????????????????????????????????<exclude>*.doc</exclude>
????????????????????????????</excludes>
????????????????????????</configuration>
????????????????????</execution>
????????????</executions>
??????????</plugin>
??????????
??????????<!--?maven打war包插件,打包后不包含pom.xml文件?-->
??????????<!--?
??????????<plugin>
??????????????<groupId>org.apache.maven.plugins</groupId>
??????????????<artifactId>maven-war-plugin</artifactId>
??????????????<version>2.1.1</version>
??????????????<configuration>?
?????????????????<archive>?
??????????????????????<addMavenDescriptor>false</addMavenDescriptor>?
????????????????</archive>?
?????????????</configuration>
??????????</plugin>
???????????-->
???????????
???????????<!--?想要把工程的所有依赖的jar都一起打包?-->
???????????<!--?
??????????<plugin>
??????????????<groupId>org.apache.maven.plugins</groupId>
??????????????<artifactId>maven-assembly-plugin</artifactId>
??????????????<version>2.2.1</version>
??????????????<configuration>
??????????????????<descriptorRefs>
????????????????????<descriptorRef>jar-with-dependencies</descriptorRef>
??????????????????</descriptorRefs>
????????????</configuration>
??????????</plugin>
???????????-->
???????????
??????????<!--?将项目所有包放到一个指定目录?-->
??????????<plugin>
??????????????<groupId>org.apache.maven.plugins</groupId>
??????????????<artifactId>maven-dependency-plugin</artifactId>
??????????????<version>2.3</version>
??????????????<executions>
????????????????????<execution>
????????????????????????<id>copy-dependencies</id>
????????????????????????<phase>package</phase>
????????????????????????<goals>
????????????????????????????<goal>copy-dependencies</goal>
????????????????????????</goals>
????????????????????????<configuration>
????????????????????????????<outputDirectory>${project.build.directory}/${project.deploy}/lib</outputDirectory>
????????????????????????????<overWriteReleases>false</overWriteReleases>
????????????????????????????<overWriteSnapshots>false</overWriteSnapshots>
????????????????????????????<overWriteIfNewer>true</overWriteIfNewer>
????????????????????????</configuration>
????????????????????</execution>
????????????</executions>
??????????</plugin>
??????????
??????</plugins>
??</build>
??<dependencies>
????<dependency>
??????<groupId>junit</groupId>
??????<artifactId>junit</artifactId>
??????<version>3.8.1</version>
??????<scope>test</scope>
????</dependency>
????
????<dependency>
????????<groupId>axis</groupId>
????????<artifactId>axis</artifactId>
????????<version>1.4</version>
????????<type>jar</type>
????????<scope>compile</scope>
????</dependency>
????<dependency>
????????<groupId>axis</groupId>
????????<artifactId>axis-jaxrpc</artifactId>
????????<version>1.4</version>
????????<type>jar</type>
????????<scope>compile</scope>
????</dependency>
????<dependency>
????????<groupId>commons-discovery</groupId>
????????<artifactId>commons-discovery</artifactId>
????????<version>20040218.194635</version>
????????<type>jar</type>
????????<scope>compile</scope>
????</dependency>
????<dependency>
????????<groupId>commons-logging</groupId>
????????<artifactId>commons-logging</artifactId>
????????<version>1.1.1</version>
????????<type>jar</type>
????????<scope>compile</scope>
????</dependency>
????<dependency>
????????<groupId>axis</groupId>
????????<artifactId>axis-saaj</artifactId>
????????<version>1.4</version>
????????<type>jar</type>
????????<scope>compile</scope>
????</dependency>
????<dependency>
????????<groupId>axis</groupId>
????????<artifactId>axis-wsdl4j</artifactId>
????????<version>1.5.1</version>
????????<type>jar</type>
????????<scope>compile</scope>
????</dependency>
??</dependencies>
</project>