一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|JAVA教程|ASP教程|編程技術|正則表達式|

服務器之家 - 編程語言 - JAVA教程 - Maven本地打包war包實現代碼解析

Maven本地打包war包實現代碼解析

2020-09-23 14:20手撕高達的村長 JAVA教程

這篇文章主要介紹了Maven本地打包war包實現代碼解析,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下

Maven是個很好用的管理工具,不經能夠管理jar,還能實現打包。

這里講解Maven 本地打包,服務器打包,可以全部交給jenkins去完成的。

用Maven打包,先在eclipse裝Maven插件,然后在pom.xml添加打包插件。

?
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<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>manager</groupId>
 <artifactId>manager</artifactId>
 <version>0.0.1</version>
 <packaging>war</packaging>
 
 <name>manager</name>
 <properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  <!--修改Language level-->
  <maven.compiler.source>1.7</maven.compiler.source>
  <!--修改Java Compiler-->
  <maven.compiler.target>1.7</maven.compiler.target>
  <spring.version>4.2.4.RELEASE</spring.version>
  <mybatis.version>3.1.1</mybatis.version>
  <log4j.version>1.2.17</log4j.version>
 </properties>
 
 
  <dependencies>
  <!-- spring 核心包 begin -->
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>${spring.version}</version>
  </dependency>
   
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    <version>${spring.version}</version>
  </dependency>
 
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>${spring.version}</version>
  </dependency>
    
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>${spring.version}</version>
  </dependency>
 
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-orm</artifactId>
    <version>${spring.version}</version>
  </dependency>
 
  <!-- spring 核心包 end -->
  <!-- springmvc 核心包 begin -->      
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>${spring.version}</version>
  </dependency>
    
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>${spring.version}</version>
  </dependency>
  
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aop</artifactId>
    <version>${spring.version}</version>
  </dependency>  
  <dependency>
     <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <scope>provided</scope>
    <version>4.0.0</version>
  </dependency>      
  <!-- springmvc 核心包 end -->
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-tx</artifactId>
    <version>${spring.version}</version>
  </dependency>
  <!-- mybatis 核心包 begin -->
  <dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis</artifactId>
    <version>${mybatis.version}</version>
  </dependency
  <dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis-spring</artifactId>
    <version>1.3.0</version>
  </dependency>  
  <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.34</version>
  </dependency>
  <!-- mybatis 核心包 end -->
  
  <!-- log4j 核心包 begin -->
  <dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>${log4j.version}</version>
  </dependency>
  <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.7.21</version>
  </dependency>
  <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.21</version>
  </dependency>    
  <!-- log4j 核心包 end -->
   <dependency>
    <groupId>redis.clients</groupId>
    <artifactId>jedis</artifactId>
    <version>2.9.0</version>
  </dependency>
  
  <dependency>
    <groupId>org.mongodb</groupId>
    <artifactId>mongodb-driver</artifactId>
    <version>3.5.0</version>
  </dependency>
 
  <!-- json 核心包 begin -->
  <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.7.4</version>
  </dependency>
  
    <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.7.4</version>
  </dependency>
  
    <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.7.4</version>
  </dependency>
  <dependency>
    <groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20180130</version>
  </dependency>
      <!-- fastjson -->
    <dependency>
      <groupId>com.alibaba</groupId>
      <artifactId>fastjson</artifactId>
      <version>1.2.31</version>
    </dependency>
  <!-- json 核心包 end -->
  <!-- thymeleaf 核心包 begin -->
    <dependency>
      <groupId>org.thymeleaf</groupId>
      <artifactId>thymeleaf</artifactId>
      <version>2.1.5.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>org.thymeleaf</groupId>
      <artifactId>thymeleaf-spring4</artifactId>
      <version>2.1.5.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>org.thymeleaf.extras</groupId>
      <artifactId>thymeleaf-extras-springsecurity3</artifactId>
      <version>2.1.2.RELEASE</version>
   </dependency>
   <!-- thymeleaf 非嚴格檢查用 -->
   <dependency>
    <groupId>net.sourceforge.nekohtml</groupId>
    <artifactId>nekohtml</artifactId>
    <version>1.9.22</version>
  </dependency>
 </dependencies>
 <!-- thymeleaf心包 end -->
 
<!-- 本地打包插件 運行Maven Install 即可-->
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.5.1</version>
        <configuration>
          <encoding>UTF-8</encoding>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-compiler-javac</artifactId>
            <version>1.9.2</version>
          </dependency>
        </dependencies>
      </plugin>
      
      <!-- 編譯插件 -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.2.1</version>
        <configuration>
          <attach>false</attach>
        </configuration>
      </plugin>
      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.9</version>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version>
        <configuration>
          <warName>manager</warName>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.sonarsource.scanner.maven</groupId>
        <artifactId>sonar-maven-plugin</artifactId>
        <version>3.3.0.603</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

選擇Maven Install 就可以在輸出日志看到打包成功的war 文件了。

Maven本地打包war包實現代碼解析

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持服務器之家。

原文鏈接:https://www.cnblogs.com/sunxun/p/9401139.html

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 免费看国产一级特黄aa大片 | 美女舒服好紧太爽了视频 | 草草视频在线观看 | 国产综合成人亚洲区 | 高人先生免费观看全集 | tiny4k欧美极品在线 | 息与子中文字幕bd | vod国产成人精品视频 | 国产亚洲精品自在线亚洲情侣 | 免费福利资源站在线视频 | 久久国产乱子伦精品免费不卡 | 99在线精品免费视频 | 男男同志videos | 暖暖免费高清完整版观看日本 | 国产ay | 欧美人禽杂交狂配无删完整 | 亚洲成人免费 | 亚洲男女网站 | 国产成人精品免费视频大全五级 | 丝袜兔女郎被啪在线观看91 | 欧美黑人换爱交换乱理伦片 | 好姑娘完整版在线观看中文 | 91色资源网在线观看 | 欧美va在线播放免费观看 | 国产一级网站 | 欧美日韩中文国产一区二区三区 | 黄色a| 国产自拍啪啪 | 亚洲 欧美 在线观看 | 97色综合 | 国产欧美日韩在线不卡第一页 | 四虎在线成人免费网站 | 久久爽狠狠添AV激情五月 | 铁牛tv 在线观看 | a级黄色视屏 | 国产精品亚洲w码日韩中文 国产精品香蕉在线观看不卡 | 亚洲AV人无码综合在线观看蜜桃 | 久久青青草视频在线观 | japanese秘书丝袜 | 国产欧美日韩一区二区三区在线 | 美女胸又大又黄又www小说 |