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";

五, 配置文件

数据库链接自己配置

相关推荐
appleyk7 小时前
MacOS-12(Intel) Docker部署Dify1.11.1
macos·docker·agent·dify·dify部署
风为你而吹8 小时前
mac m3上使用vscode + platformio开发esp32
ide·vscode·macos
想做后端的小C8 小时前
Mac 环境下设置 idea 中的 tomcat 运行配置
macos·tomcat·intellij-idea
转战英雄枫1 天前
Mac上打开安卓虚拟机BlueStacks Air闪退问题解决
macos·bluestacks
liliangcsdn1 天前
mac m1安装homebrew和iterm2示例
macos
墨&白.1 天前
如何卸载/更新Mac上的R版本
开发语言·macos·r语言
游戏开发爱好者81 天前
苹果 App 上架流程,结合 Xcode、CI 等常见工具
macos·ios·ci/cd·小程序·uni-app·iphone·xcode
科技智驱1 天前
Mac废纸篓清空的东西能还原吗?找回Mac废纸篓数据的教程
macos·数据恢复
猫头虎2 天前
GoLand 2025.3 最新变化:值得更新吗?
ide·windows·macos·pycharm·编辑器·intellij-idea·idea
_可乐无糖2 天前
内网穿透工具使用指南:ngrok 和 cpolar
安全·macos·云计算