1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<
plugins
>
<!-- 内置打包法 -->
<
plugin
>
<
groupId
>org.apache.maven.plugins</
groupId
>
<!-- 用这个maven打包插件 -->
<
artifactId
>maven-shade-plugin</
artifactId
>
<
version
>2.3</
version
>
<
executions
>
<
execution
>
<
phase
>package</
phase
>
<
goals
>
<
goal
>shade</
goal
>
</
goals
>
<
configuration
>
<!-- 默认值为true.注意这个属性,如果你用这个插件来deploy,或者发布到中央仓库,这个属性会缩减你的pom文件,会把你依赖的<dependency>干掉 -->
<
createDependencyReducedPom
>false</
createDependencyReducedPom
>
<
transformers
>
<
transformer
implementation
=
"org.apache.maven.plugins.shade.resource.AppendingTransformer"
>
<
resource
>META-INF/spring.handlers</
resource
>
</
transformer
>
<
transformer
implementation
=
"org.apache.maven.plugins.shade.resource.AppendingTransformer"
>
<
resource
>META-INF/spring.schemas</
resource
>
</
transformer
>
<
transformer
implementation
=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"
>
<!-- 这个是你的程序入口文件 -->
<
mainClass
>com.alibaba.dubbo.container.Main</
mainClass
>
</
transformer
>
</
transformers
>
</
configuration
>
</
execution
>
</
executions
>
</
plugin
>
<
plugin
>
<
groupId
>org.apache.maven.plugins</
groupId
>
<
artifactId
>maven-resources-plugin</
artifactId
>
<
version
>2.4</
version
>
<
configuration
>
<!-- 设置字符编码集 -->
<
encoding
>UTF-8</
encoding
>
</
configuration
>
</
plugin
>
</
plugins
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<
plugins
>
<!-- 打包jar文件时,配置manifest文件,加入lib包的jar依赖 -->
<
plugin
>
<
groupId
>org.apache.maven.plugins</
groupId
>
<
artifactId
>maven-jar-plugin</
artifactId
>
<
configuration
>
<
classesDirectory
>target/classes/</
classesDirectory
>
<
archive
>
<
manifest
>
<
mainClass
>com.alibaba.dubbo.container.Main</
mainClass
>
<!-- 打包时 MANIFEST.MF文件不记录的时间戳版本 -->
<
useUniqueVersions
>false</
useUniqueVersions
>
<
addClasspath
>true</
addClasspath
>
<
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
</
outputDirectory
>
</
configuration
>
</
execution
>
</
executions
>
</
plugin
>
</
plugins
>
|