spring cloud 使用maven-assembly-plugin打zip包_spring cloud项目打zip包

Docker步步实践

目录文档:

①Docker简介

②基本概念

③安装Docker

④使用镜像:

⑤操作容器:

⑥访问仓库:

⑦数据管理:

⑧使用网络:

⑨高级网络配置:

⑩安全:

⑪底层实现:

⑫其他项目:

本文已被CODING开源项目:【一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码】收录

需要这份系统化的资料的朋友,可以点击这里获取

<?xml version="1.0" encoding="UTF-8"?>  
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">  
    <id>package</id>  
    <formats>  
        <format>zip</format>  
    </formats>  
    <includeBaseDirectory>true</includeBaseDirectory>  
    <fileSets>  
        <fileSet>  
            <directory>src/main/bin</directory>  
            <outputDirectory>bin</outputDirectory>  
        </fileSet>  
       <fileSet>  
            <directory>src/main/conf</directory>  
            <outputDirectory>conf</outputDirectory>  
        </fileSet>  
        <fileSet>  
            <directory>src/main/logs</directory>  
            <outputDirectory>logs</outputDirectory>  
        </fileSet>  
        <fileSet>  
            <directory>src/main/work</directory>  
            <outputDirectory>work</outputDirectory>  
        </fileSet>  
        <fileSet>  
            <directory>${project.build.directory}</directory>  
            <outputDirectory>/</outputDirectory>  
            <includes>  
                <include>*.jar</include>  
            </includes>  
        </fileSet>  
    </fileSets>  
    <dependencySets>  
        <dependencySet>  
            <outputDirectory>lib</outputDirectory>  
            <scope>runtime</scope>  
<!--             <unpack>false</unpack> -->  
            <excludes>  
<!--                 <exclude>${project.name}-${project.version}</exclude> -->  
                <exclude>${groupId}:${artifactId}</exclude>  
            </excludes>  
        </dependencySet>  
    </dependencySets>  
</assembly>  

3、新建目录工程

4、放入启动、停止、查看脚本

/mnt/jdk1.8.0_151/bin/java -jar -Xms512m -Xmx512m -Dserver.port=8008 -Dfile.encoding=UTF-8  ../lib/xxxxx.jar > ../logs/log.out 2>&1 &
tail -f ./logs/log.out
#!/bin/sh
pid=`ps -ef | grep xxxx.jar | grep -v grep | awk '{print $2}'`
if   [ -z $pid ];then
                echo   "There isn't this process!"
  else
      echo "This process is "$pid
      kill -9 $pid
fi
#!/bin/sh
ps -aux | grep "8008"

5、使用maven打包,命令
mvn clean assembly:assembly

学习分享,共勉

这里是小编拿到的学习资源,其中包括“中高级Java开发面试高频考点题笔记300道.pdf”和“Java核心知识体系笔记.pdf”文件分享,内容丰富,囊括了JVM、锁、并发、Java反射、Spring原理、微服务、Zookeeper、数据库、数据结构等大量知识点。同时还有Java进阶学习的知识笔记脑图(内含大量学习笔记)!

资料整理不易,读者朋友可以转发分享下!

Java核心知识体系笔记.pdf

记一次蚂蚁金服Java研发岗的面试经历,分享下我的复习笔记面经

中高级Java开发面试高频考点题笔记300道.pdf

记一次蚂蚁金服Java研发岗的面试经历,分享下我的复习笔记面经

架构进阶面试专题及架构学习笔记脑图

记一次蚂蚁金服Java研发岗的面试经历,分享下我的复习笔记面经

Java架构进阶学习视频分享

本文已被CODING开源项目:【一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码】收录

需要这份系统化的资料的朋友,可以点击这里获取

学习笔记+最新讲解视频+实战项目源码】](https://bbs.csdn.net/forums/4f45ff00ff254613a03fab5e56a57acb)收录**

需要这份系统化的资料的朋友,可以点击这里获取

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Maven Assembly Plugin 是 Maven 的一个插件,可以用来生成自定义的格式的括瘦。 所谓瘦,是指只含应用程序运行所必需的类和资源文件,不含不必要的依赖。这样可以减小应用程序的大小,提高应用程序的启动速度。 以下是使用 Maven Assembly Plugin 生成瘦的步骤: 1. 在 pom.xml 文件中添加 Maven Assembly Plugin 的依赖: ```xml <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>3.3.0</version> </dependency> ``` 2. 在 pom.xml 文件中配置 Maven Assembly Plugin: ```xml <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>3.3.0</version> <executions> <execution> <id>package-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <mainClass>com.example.MainClass</mainClass> </manifest> </archive> </configuration> </execution> </executions> </plugin> </plugins> </build> ``` 在上述配置中,使用了 `jar-with-dependencies` 描述符,该描述符会将所有依赖都打入生成的 JAR 文件中,因此生成的 JAR 文件会比较大,不符合瘦的要求。因此,我们需要在 Maven Assembly Plugin 的配置中添加一些配置项,来剔除不必要的依赖。例如,可以使用以下配置来排除 `slf4j` 依赖: ```xml <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <mainClass>com.example.MainClass</mainClass> </manifest> </archive> <dependencySets> <dependencySet> <outputDirectory>/lib</outputDirectory> <useProjectArtifact>false</useProjectArtifact> <excludes> <exclude>org.slf4j:*</exclude> </excludes> </dependencySet> </dependencySets> </configuration> ``` 在上述配置中,使用了 `dependencySet` 元素来排除 `slf4j` 依赖,将其放置在 `/lib` 目录下,这样就可以生成一个瘦了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值