全国免费服务热线:

18982081108
✕

成都弹性云服务器,成都高防云服务器,互联网数据服务,成都祈钰瑶

33.Apollo引入第三方Jar包编译

一. 前言

中宁ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18982081108(备注:SSL证书合作)期待与您的合作!

在编译完Apollo源代码后,我们可能会自己修改Apollo源代码,添加自己的功能,然后编译出来。

修改代码有个时候会用到第三方Jar包,那么怎么打包到Apollo里面去呢?

二. 修改pom.xml

在项目的pom.xml中添加包引入,以fastjson为例

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>fastjson</artifactId>
    <version>1.2.31</version>
    <scope>compile</scope>
</dependency>

三. 修改打包文件

位置

源代码根目录/apollo/apollo-distro/src/main/descriptors/common-bin.xml

<dependencySets>
    <dependencySet>
      <outputDirectory>/lib</outputDirectory>
      <unpack>false</unpack>
      <useTransitiveDependencies>true</useTransitiveDependencies>
      <includes>
        <include>org.apache.activemq:apollo-*</include>
        
        <!-- main apollo dependencies -->
        <include>org.scala-lang:scala-library</include>

        <!-- customer add begin -->
        <include>com.alibaba:fastjson</include>
        ...
...

四. 重新编译打包

http://483181.blog.51cto.com/473181/1950769