maven针对JAVA-SE项目的打包范例

<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>spider</groupId>

<artifactId>spider</artifactId>

<version>0.0.1-SNAPSHOT</version>

<name>spider</name>

<build>



<!-- 自定义源文件目录 -->

<sourceDirectory>src</sourceDirectory>

<!-- 自定义资源 -->

<resources>

<resource>

<directory>src</directory>

<includes>

<include>**/*.properties</include>

</includes>

</resource>

</resources>





<plugins>

<!-- 打jar包的main方法配置 -->

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-jar-plugin</artifactId>

<configuration>

<archive>

<manifest>

<addClasspath>true</addClasspath>

<classpathPrefix>lib/</classpathPrefix>

<mainClass>test.socket.ServerSocketTest</mainClass>

</manifest>

</archive>

</configuration>

</plugin>

<!-- 将所依赖的第三方jar包打入target下的lib目录 -->

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-dependency-plugin</artifactId>

<version>2.2</version>

<executions>

<execution>

<id>copy</id>

<!-- 此处原为install,后来改为package(执行maven的package命令时做拷贝操作) -->

<phase>package</phase>

<goals>

<goal>copy-dependencies</goal>

</goals>

<configuration>

<!-- 其中${project.build.directory}是maven变量,表示target目录.

如果不写的话,将在根目录下创建lib目录。 -->

<outputDirectory>

${project.build.directory}/lib

</outputDirectory>

<!--

<excludeTransitive>false</excludeTransitive>

excludeTransitive表示是否不包含间接依赖的包

-->

<!--

<stripVersion>true</stripVersion>

stripVersion表示复制的jar文件去掉版本信息。

-->

</configuration>

</execution>

</executions>

</plugin>

</plugins>

</build>

<dependencies>

<dependency>

<groupId>jfreechart</groupId>

<artifactId>jfreechart</artifactId>

<version>1.0.0</version>

</dependency>

<dependency>

<groupId>log4j</groupId>

<artifactId>log4j</artifactId>

<version>1.2.11</version>

</dependency>

<dependency>

<groupId>commons-httpclient</groupId>

<artifactId>commons-httpclient</artifactId>

<version>3.1</version>

</dependency>

<dependency>

<groupId>commons-codec</groupId>

<artifactId>commons-codec</artifactId>

<version>1.3</version>

</dependency>

<dependency>

<groupId>commons-logging</groupId>

<artifactId>commons-logging</artifactId>

<version>1.0.4</version>

</dependency>

<dependency>

<groupId>commons-lang</groupId>

<artifactId>commons-lang</artifactId>

<version>2.5</version>

</dependency>

<dependency>

<groupId>commons-collections</groupId>

<artifactId>commons-collections</artifactId>

<version>3.1</version>

</dependency>

<dependency>

<groupId>commons-io</groupId>

<artifactId>commons-io</artifactId>

<version>1.1</version>

</dependency>

<dependency>

<groupId>rome</groupId>

<artifactId>rome</artifactId>

<version>0.8</version>

</dependency>

<dependency>

<groupId>org.jdom</groupId>

<artifactId>jaxen-jdom</artifactId>

<version>1.0-FCS</version>

</dependency>

<dependency>

<groupId>dom4j</groupId>

<artifactId>dom4j</artifactId>

<version>1.6.1</version>

</dependency>

<dependency>

<groupId>net.sourceforge.javacsv</groupId>

<artifactId>javacsv</artifactId>

<version>2.0</version>

</dependency>

<dependency>

<groupId>mysql</groupId>

<artifactId>mysql-connector-java</artifactId>

<version>5.1.14</version>

</dependency>

</dependencies>

<modules>

</modules>

</project>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值