Nacos-2.2.2源码修改集成高斯数据库GaussDB,postresql

一 ,下载代码

Release 2.2.2 (Apr 11, 2023) · alibaba/nacos · GitHub

二, 执行打包

mvn -Prelease-nacos -Dmaven.test.skip=true -Drat.skip=true clean install -U

mvn -Prelease-nacos '-Dmaven.test.skip=true' '-Drat.skip=true' clean install -U

注意:请不要把源码放在中文路径下,会报各种意想不到的错误。

打包的结果在distribution中

三,添加驱动jar包

1,根目录下:/pom.xml

postgresql

复制代码
<postgresql.version>42.3.3</postgresql.version>

<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>${postgresql.version}</version>
</dependency>

高斯的

复制代码
<opengauss.version>3.0.0</opengauss.version>

<dependency>
    <groupId>org.opengauss</groupId>
    <artifactId>opengauss-jdbc</artifactId>
    <version>${opengauss.version}</version>
</dependency>

2,config项目下的 /pom.xml

postgresql的

复制代码
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
</dependency>

高斯的

复制代码
<dependency>
   <groupId>org.opengauss</groupId>
   <artifactId>opengauss-jdbc</artifactId>
</dependency>

3,naming项目下的

postgresql的

复制代码
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
</dependency>

高斯的

复制代码
 <dependency>
      <groupId>org.opengauss</groupId>
      <artifactId>opengauss-jdbc</artifactId>
 </dependency>

四,添加PostgreSQL驱动代码

高斯的驱动代码和PostgreSQL是一模一样的

① PropertiesConstant.java

复制代码
    public static final String POSTGRESQL = "postgresql";

② PropertyUtil.java#loadSetting

复制代码
String platform = DatasourcePlatformUtil.getDatasourcePlatform("");
            /*boolean useExternalStorage = !PropertiesConstant.EMPTY_DATASOURCE_PLATFORM.equalsIgnoreCase(platform)
                    && !PropertiesConstant.DERBY.equalsIgnoreCase(platform);
             setUseExternalDB(useExternalStorage);*/
            setUseExternalDB(PropertiesConstant.MYSQL.equalsIgnoreCase(platform) || PropertiesConstant.POSTGRESQL.equalsIgnoreCase(platform));

③ ExternalDataSourceProperties.java

复制代码
    private static final String JDBC_DRIVER_NAME_POSTGRESQL = "org.postgresql.Driver";

④ StartingApplicationListener.java

复制代码
    private static final String DATABASE_POSTGRESQL = "postgresql";

五, 配置文件

数据库链接自己配置

相关推荐
Mac技巧大咖1 天前
苹果电脑如何维护优化系统:让mac重获新生的系统维护优化全攻略
macos·苹果电脑系统优化
氷泠1 天前
解决MacOS上CLion调试的时候容器的值显示为0的问题
macos·调试·lldb·clion
他们都不看好你,偏偏你最不争气1 天前
【iOS】KVC总结
macos·ios·objective-c·cocoa·kvc
1024小神2 天前
关于在ios系统中签名并安装ipa文件的五种方法,PakePlus打包的ipa文件可以看看
macos·ios·cocoa
漂亮_大男孩2 天前
conda|如何通过命令行在mac上下载conda
macos·conda
止观止2 天前
VS Code 二次开发:跨平台图标定制全攻略
linux·windows·vscode·macos
小瓶盖_tl2 天前
在Mac上安装CocoaPods问题处理
macos·xcode·cocoapods
游戏开发爱好者83 天前
苹果iOS26系统升级:液态玻璃与智能功能全解析
macos·ios·小程序·uni-app·objective-c·cocoa·iphone
Aftery的博客3 天前
flutter项目打包macOS桌面程序dmg
flutter·macos
心灵宝贝3 天前
4K Wallpaper mac v2.7.dmg 安装教程(Mac电脑详细安装步骤4K壁纸Mac下载安装)
macos