Nacos-2.2.2源码修改集成高斯数据库GaussDB,postresql-CSDN博客
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |
一 下载代码
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.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>
2config项目下的 /pom.xml
postgresql的
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
高斯的
<dependency>
<groupId>org.opengauss</groupId>
<artifactId>opengauss-jdbc</artifactId>
</dependency>
3naming项目下的
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";
五 配置文件
数据库链接自己配置