解压缩 jar 文件
jar xf xxx.jar
解压后,配置文件在这个位置vim BOOT-INF/classes/application.properties
操作记录
解压jar包查看配置文件
[root@tdata-service-1 platform-service]# ls
log start_service.sh dodata-tdata-service.jar
[root@tdata-service-1 platform-service]# jar xf dodata-tdata-service.jar
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/local/skywalking/agent/skywalking-agent.jar
DEBUG 2022-12-16 16:10:52:912 main AgentPackagePath : The beacon class location is jar:file:/usr/local/skywalking/agent/skywalking-agent.jar!/org/apache/skywalking/apm/agent/core/boot/AgentPackagePath.class.
INFO 2022-12-16 16:10:52:914 main SnifferConfigInitializer : Config file found in /usr/local/skywalking/agent/config/agent.config.
[root@tdata-service-1 platform-service]# ls
BOOT-INF META-INF log org start_service.sh dodata-tdata-service.jar
# 可以看到所有的依赖jar包
[root@tdata-service-1 platform-service]# ls BOOT-INF/lib/
HdrHistogram-2.1.12.jar druid-1.1.22.jar jetty-server-9.4.45.v20220203.jar simpleclient-0.12.0.jar
HikariCP-4.0.3.jar druid-spring-boot-starter-1.1.22.jar jetty-servlet-9.4.45.v20220203.jar simpleclient_common-0.12.0.jar
LatencyUtils-2.0.3.jar ehcache-2.10.9.2.jar jetty-servlets-9.4.45.v20220203.jar simpleclient_pushgateway-0.9.0.jar
# 可以看到所有的配置文件
[root@tdata-service-1 platform-service]# ls BOOT-INF/classes
application-exp.properties biz-default-params.properties com init_sql_2020_1215.sql init_sql_20210826_JC180.sql init_sql_20211022_JC191.sql init_sql_2022-12_05.sql log start_service.sh dodata_role_opt_demo.json
application.properties bootstrap.yml init_sql.sql init_sql_20210813_JC170.sql init_sql_20210917_JC190.sql init_sql_2021_0127.sql init_sql_20220126_JC0.sql log4j2.component.properties dodata_role_opt.json
# 可以发现打包的是exp配置文件, 而不是dev文件.
[root@tdata-service-1 platform-service]# cat BOOT-INF/classes/application-exp.properties
#DANGER! include production configs at the end!
参考文档
Extracting the Contents of a JAR File
https://docs.oracle.com/javase/tutorial/deployment/jar/unpack.html
The basic command to use for extracting the contents of a JAR file is:
jar xf jar-file [archived-file(s)]
Let's look at the options and arguments in this command:
- The x option indicates that you want to extract files from the JAR archive.
- The f options indicates that the JAR file from which files are to be extracted is specified on the command line, rather than through stdin.
- The jar-file argument is the filename (or path and filename) of the JAR file from which to extract files.
- archived-file(s) is an optional argument consisting of a space-separated list of the files to be extracted from the archive. If this argument is not present, the Jar tool will extract all the files in the archive.
- As usual, the order in which the x and f options appear in the command doesn't matter, but there must not be a space between them.