Browse Source

pom的BUG修复、优化

huangbo 6 years ago
parent
commit
2c1d65c096
2 changed files with 236 additions and 20 deletions
  1. 14 20
      ipu-rest-demo/pom.xml
  2. 222 0
      ipu-rest-demo/pom_part.xml

+ 14 - 20
ipu-rest-demo/pom.xml

@ -113,28 +113,22 @@
113 113
                    <skip>true</skip>
114 114
                </configuration>
115 115
            </plugin>
116
            <!-- <plugin>
116
			<!-- 比spring-boot-dependencies中多了build-info -->
117
			<plugin>
117 118
				<groupId>org.springframework.boot</groupId>
118 119
				<artifactId>spring-boot-maven-plugin</artifactId>
119
			</plugin> -->
120
			
121
			<!-- maven-resources-plugin默认会执行 -->
122
			<plugin>
123
                <groupId>org.apache.maven.plugins</groupId>
124
                <artifactId>maven-resources-plugin</artifactId>
125
	        </plugin>
126
	        <plugin>
127
                <groupId>org.apache.maven.plugins</groupId>
128
                <artifactId>maven-dependency-plugin</artifactId>
129
            </plugin>
130
            <plugin>
131
	            <groupId>org.apache.maven.plugins</groupId>
132
	            <artifactId>maven-jar-plugin</artifactId>
133
            </plugin>
134
            <plugin>
135
                <groupId>org.apache.maven.plugins</groupId>
136
                <artifactId>maven-assembly-plugin</artifactId>
137
            </plugin>
120
				<executions>
121
					<execution>
122
						<goals>
123
							<goal>repackage</goal>
124
							<goal>build-info</goal>
125
						</goals>
126
					</execution>
127
				</executions>
128
				<configuration>
129
					<mainClass>${start-class}</mainClass>
130
				</configuration>
131
			</plugin>
138 132
		</plugins>
139 133
		<finalName>${project.artifactId}</finalName>
140 134
	</build>

+ 222 - 0
ipu-rest-demo/pom_part.xml

@ -0,0 +1,222 @@
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
	<modelVersion>4.0.0</modelVersion>
4
	<parent>
5
		<groupId>com.ai.ipu.server</groupId>
6
		<artifactId>ipu-rest-libs</artifactId>
7
		<version>3.1-SNAPSHOT</version>
8
	</parent>
9
10
	<artifactId>ipu-rest-demo</artifactId>
11
	<packaging>jar</packaging>
12
13
	<name>ipu-rest-demo</name>
14
	<url>http://maven.apache.org</url>
15
16
	<repositories>
17
		<!-- IPU相关仓库 -->
18
		<repository>
19
			<id>ipu</id>
20
			<name>ipu repository</name>
21
			<url>http://114.215.100.48:9090/nexus/content/groups/public/</url>
22
			<releases>
23
				<enabled>true</enabled>
24
			</releases>
25
			<snapshots>
26
				<enabled>true</enabled>
27
				<updatePolicy>always</updatePolicy>
28
			</snapshots>
29
		</repository>
30
	</repositories>
31
32
	<properties>
33
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
34
		<start-class>com.ai.ipu.server.demo.IpuRestDemoStart</start-class>
35
		<msgframe>1.9.2</msgframe>
36
		<jms>1.1</jms>
37
	</properties>
38
39
	<dependencies>
40
		<dependency>
41
			<groupId>junit</groupId>
42
			<artifactId>junit</artifactId>
43
			<scope>test</scope>
44
		</dependency>
45
		<dependency>
46
			<groupId>javax.servlet</groupId>
47
			<artifactId>javax.servlet-api</artifactId>
48
			<scope>provided</scope>
49
		</dependency>
50
		<!-- 由于重写了spring的部分类,需要置前引入,提高优先级 -->
51
		<dependency>
52
			<groupId>com.ai.ipu.server</groupId>
53
			<artifactId>ipu-restful</artifactId>
54
		</dependency>
55
		<!-- spring监听,admin-client会引入actuator -->
56
		<dependency>  
57
		    <groupId>de.codecentric</groupId>  
58
		    <artifactId>spring-boot-admin-starter-client</artifactId>
59
		</dependency>
60
		<dependency>
61
			<groupId>com.ai.wade</groupId>
62
			<artifactId>wade-data</artifactId>
63
		</dependency>
64
		<dependency>
65
			<groupId>com.ai.ipu</groupId>
66
			<artifactId>ipu-server-web</artifactId>
67
		</dependency>
68
		<!-- dubbo相关依赖 -->
69
		<dependency>
70
			<groupId>com.alibaba</groupId>
71
			<artifactId>dubbo</artifactId>
72
		</dependency>
73
		<dependency>
74
		    <groupId>com.github.sgroschupf</groupId>
75
		    <artifactId>zkclient</artifactId>
76
		</dependency>
77
		<dependency>
78
		    <groupId>com.netflix.curator</groupId>
79
		    <artifactId>curator-framework</artifactId>
80
		</dependency>
81
		<!-- msgframe相关依赖 -->
82
		<dependency>
83
			<groupId>com.ai.aif.msgframe</groupId>
84
  			<artifactId>msgframe-client</artifactId>
85
  			<version>${msgframe}</version>
86
  		</dependency>
87
  		<dependency>
88
		    <groupId>javax.jms</groupId>
89
		    <artifactId>jms</artifactId>
90
		    <version>${jms}</version>
91
		</dependency>
92
	</dependencies>
93
94
	<build>
95
		<plugins>
96
			<plugin>
97
				<artifactId>maven-compiler-plugin</artifactId>
98
				<configuration>
99
					<source>${compiler-version}</source>
100
					<target>${compiler-version}</target>
101
					<encoding>${encoding}</encoding>
102
					<!-- 通过此方法添加本地jar -->
103
					<compilerArguments>
104
	 					<bootclasspath>${JAVA_HOME}/jre/lib/rt.jar</bootclasspath>
105
	 					<extdirs>${project.basedir}/libs</extdirs>
106
					</compilerArguments>
107
				</configuration>
108
			</plugin>
109
			<plugin>
110
                <groupId>org.apache.maven.plugins</groupId>
111
                <artifactId>maven-surefire-plugin</artifactId>
112
                <configuration>
113
                    <skip>true</skip>
114
                </configuration>
115
            </plugin>
116
            <!-- ==========应用包和依赖包分离的打包方法================ -->
117
				<plugin>
118
	                <groupId>org.apache.maven.plugins</groupId>
119
	                <artifactId>maven-resources-plugin</artifactId>
120
	                <executions>
121
	                    <execution>
122
	                        <id>copy-resources</id>
123
	                        <phase>compile</phase>
124
	                        <goals>
125
	                            <goal>copy-resources</goal>
126
	                        </goals>
127
	                        <configuration>
128
	                            <encoding>${encoding}</encoding>
129
	                            <resources>
130
	                                <resource>
131
	                                    <directory>${project.build.directory}/classes</directory>
132
	                                    <includes>
133
	                                        <include>**/*.properties</include>
134
	                                        <include>**/*.xml</include>
135
	                                        <include>**/*.yaml</include>
136
	                                        <include>**/*.yml</include>
137
	                                        <include>**/*.txt</include>
138
	                                    </includes>
139
	                                </resource>
140
	                            </resources>
141
	                            <!-- 表示把配置文件拷到和jar包同一个路径下 -->
142
	                            <outputDirectory>
143
	                                ${project.build.directory}/config
144
	                            </outputDirectory>
145
	                        </configuration>
146
	                    </execution>
147
	                </executions>
148
	            </plugin>
149
	            <!-- 复制依赖包 -->
150
	            <plugin>
151
	                <groupId>org.apache.maven.plugins</groupId>
152
	                <artifactId>maven-dependency-plugin</artifactId>
153
	                <executions>
154
	                    <execution>
155
	                        <id>copy-dependencies</id>
156
	                        <phase>package</phase>
157
	                        <goals>
158
	                            <goal>copy-dependencies</goal>
159
	                        </goals>
160
	                        <configuration>
161
	                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
162
	                        </configuration>
163
	                    </execution>
164
	                </executions>
165
	            </plugin>
166
	            <plugin>
167
	                <groupId>org.apache.maven.plugins</groupId>
168
	                <artifactId>maven-jar-plugin</artifactId>
169
	                <configuration>
170
	                    <archive>
171
	                        <!--生成的jar中,不要包含pom.xml和pom.properties这两个文件-->
172
	                        <addMavenDescriptor>false</addMavenDescriptor>
173
	                        <manifest>
174
	                            <!--是否要把第三方jar放到manifest的classpath中-->
175
	                            <addClasspath>true</addClasspath>
176
	                            <!--生成的manifest中classpath的前缀,lib存放第三方jar-->
177
	                            <classpathPrefix>lib/</classpathPrefix>
178
	                            <!--应用的main class-->
179
	                            <mainClass>${start-class}</mainClass>
180
	                        </manifest>
181
	                        <!-- 自定义的MANIFEST.MF参数 -->
182
	                        <manifestEntries>
183
	                        	<!-- 增加classpath目录config -->
184
	                            <Class-Path>./config/</Class-Path>
185
	                        </manifestEntries>
186
	                    </archive>
187
	                    <!--过滤掉不希望包含在jar中的文件-->
188
	                    <excludes>
189
	                        <exclude>**/*.properties</exclude>
190
	                        <exclude>**/*.xml</exclude>
191
	                        <exclude>**/*.yaml</exclude>
192
	                        <exclude>**/*.yml</exclude>
193
	                        <exclude>**/*.txt</exclude>
194
	                    </excludes>
195
	                </configuration>
196
	            </plugin>
197
			
198
				<plugin>
199
	                <groupId>org.apache.maven.plugins</groupId>
200
	                <artifactId>maven-assembly-plugin</artifactId>
201
	                <version>2.4</version>
202
	                <!-- The configuration of the plugin -->
203
	                <configuration>
204
	                    <!-- Specifies the configuration file of the assembly plugin -->
205
	                    <descriptors>
206
	                        <descriptor>src/main/assembly-package.xml</descriptor>
207
	                    </descriptors>
208
	                </configuration>
209
	                <executions>
210
	                    <execution>
211
	                        <id>make-assembly</id>
212
	                        <phase>package</phase>
213
	                        <goals>
214
	                            <goal>single</goal>
215
	                        </goals>
216
	                    </execution>
217
	                </executions>
218
	            </plugin>
219
		</plugins>
220
		<finalName>${project.artifactId}</finalName>
221
	</build>
222
</project>