```xml <!-- docker maven打包插件;可以将应用做成docker镜像 --> <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>0.4.12</version> <configuration> <!-- 注意imageName一定要是符合正则[a-z0-9-_.]的,否则构建不会成功 --> <!-- 详见:https://github.com/spotify/docker-maven-plugin Invalid repository name ... only [a-z0-9-_.] are allowed--> <imageName>spring-boot-demo</imageName> <baseImage>java</baseImage> <entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint> <resources> <resource> <targetPath>/</targetPath> <directory>${project.build.directory}</directory> <include>${project.build.finalName}.jar</include> </resource> </resources> </configuration> </plugin> <!--测试--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.20</version> <configuration> <skipTests>true</skipTests> <forkMode>once</forkMode> <argLine>-Dfile.encoding=UTF-8</argLine> </configuration> </plugin> <!--JDK编译插件--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.2</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </configuration> </plugin> <!-- tomcat7插件 --> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <port>80</port> <path>/</path> </configuration> </plugin> ``` ```xml <!--打包的插件 执行assembly:single--> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <archive> <manifest> <!-- 注意 此为设置程序的主入口--> <mainClass>cn.xxx.main.NewsMain</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </plugin>
```
```xml tomcat7插件 <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <configuration> <port>8080</port> <!-- 表示在根目录运行,不用加工程名 --> <path>/</path> </configuration> </plugin> ```
都是一些常见的打包工具可以直接使用,maven作为管理工具还是比较方便的
*******************************************************************************************************************************
感谢阿贝云提供的免费云服务器和免费虚拟主机,1C1G5M配置,搭配内网穿透,真香,看视频听歌曲无压力,*
运行起来也相当流畅,网速个人使用是真的赞,欢迎大家使用
*******************************************************************************************************************************