maven的pom文件
pom.xml打jar包时加入依赖的包:
<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.scenery</groupId>
<artifactId>DataService</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>DataService</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>central</id>
<url>http://repo.corp/artifactory/repo</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.13</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<!-- NOTE: We don't need a groupId specification because the group is
org.apache.maven.plugins ...which is assumed by default.
-->
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
</project>maven命令:
1. mvn clean install
2. mvn assembly:assembly
即可生成包含依赖jar的jar包。
相关推荐
kevincheung 2020-05-17
也许不会看见 2020-01-28
ApachePHPMySQL 2014-07-10
糊一笑 2019-12-18
ithzhang 2019-12-12
登峰小蚁 2019-10-24
在旅途 2019-10-06
wangzhe00 2016-04-19
keyxiaodj 2019-09-05
xiaoxin0 2017-07-09
LJ 2016-02-25
fuel 2017-09-25
yangxiaobo 2014-08-21
Selier 2015-03-11
HaleyJenkins 2014-01-08
xiaoxin0 2013-04-20
周太郎 2012-03-03