赞
踩
前言
线上包,要加一个加密的配置包,但是不想重新打包过去,只加一个配置类
可以用解压软件解压也可以用命令解压
解压jar包命令: jar xvf xxx.jar
打包jar包命令: jar cvfM0 xxx.jar ./*
( *
或者 ./*
都可以)
先把 这个jar 解压了,然后把 BOOT-INF/lib
里面的jia包该添加添加该替换替换,如果只是增加class类,则到 BOOT-INF/classes
把相应的class放到相应的类路径上
替换好后,可以用这个指令: jar cvfM0 admin.jar *
( *
表示当前目录所有文件)
重新打包好后,替换过去重启服务即可
在项目的 pom.xml
中添加以下配置即可
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <!--指定入口类 --> <mainClass>com.gov.platform.AdapterApiApplication</mainClass> </manifest> </archive> <excludes> <!--排除配置文件,由外部resources下的配置文件来配置 --> <exclude>/application*.properties</exclude> <!--<exclude>/*.properties</exclude>--> </excludes> <outputDirectory>${project.build.directory}</outputDirectory> </configuration> </plugin> <!-- 分离lib --> <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> <!-- 依赖包输出目录 --> <outputDirectory>${project.build.directory}/lib</outputDirectory> <excludeTransitive>false</excludeTransitive> <stripVersion>false</stripVersion> <!-- 依赖包的作用域 --> <includeScope>runtime</includeScope> <!-- 需要打进主程序包的jar包, 多个以英文逗号隔开 --> <excludeArtifactIds>common-plugin</excludeArtifactIds> </configuration> </execution> </executions> </plugin> <!-- springboot repackage, 需要打进主程序包的jar包 --> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <layout>ZIP</layout> <addResources>true</addResources> <outputDirectory>${project.build.directory}</outputDirectory> <includes> <include> <groupId>com.gov.platform</groupId> <artifactId>common-plugin</artifactId> </include> </includes> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> <!-- springboot repackage --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <!-- JPA querydsl生成Q类 --> <plugin> <groupId>com.mysema.maven</groupId> <artifactId>apt-maven-plugin</artifactId> <version>1.1.3</version> <executions> <execution> <goals> <goal>process</goal> </goals> <configuration> <outputDirectory>target/generated-sources/java</outputDirectory> <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor> </configuration> </execution> </executions> </plugin> <!--git 提交id 打包--> <plugin> <groupId>pl.project13.maven</groupId> <artifactId>git-commit-id-plugin</artifactId> <configuration> <includeOnlyProperties> <includeOnlyProperty>git.commit.id</includeOnlyProperty> </includeOnlyProperties> </configuration> </plugin> <!-- 时间变量插件, ${build.time} 即可使用该插件--> <!-- <plugin>--> <!-- <groupId>org.codehaus.mojo</groupId>--> <!-- <artifactId>build-helper-maven-plugin</artifactId>--> <!-- <executions>--> <!-- <execution>--> <!-- <id>timestamp-property</id>--> <!-- <goals>--> <!-- <goal>timestamp-property</goal>--> <!-- </goals>--> <!-- </execution>--> <!-- </executions>--> <!-- <configuration>--> <!-- <name>build.time</name>--> <!-- <pattern>YYMMddHH</pattern>--> <!-- <timeZone>GMT+8</timeZone>--> <!-- </configuration>--> <!-- </plugin>--> </plugins> </build>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。