Add database dependencies for Relational.

The R2DBC dependencies are only found if they are defined in spring-data-relational, which is done by https://github.com/spring-projects/spring-data-relational/pull/1892

Closes #97
This commit is contained in:
Jens Schauder
2024-09-17 13:01:10 +02:00
committed by Mark Paluch
parent b6455f84b5
commit d7affa8561
3 changed files with 36 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ import org.springframework.util.ReflectionUtils;
/**
* @author Mark Paluch
* @author Jens Schauder
*/
public class Dependencies {
@@ -134,6 +135,21 @@ public class Dependencies {
public static final Dependency MAVEN = Dependency.of("Maven Wrapper", "org.apache.maven:apache-maven");
public static final Dependency H2 = Dependency.of("H2 Database", "com.h2database:h2");
public static final Dependency H2_R2DBC = Dependency.of("H2 R2DBC Driver", "io.r2dbc:r2dbc-h2");
public static final Dependency HSQLDB = Dependency.of("HSQL Database", "org.hsqldb:hsqldb");
public static final Dependency DB2_JDBC = Dependency.of("DB2 JDBC Driver", "com.ibm.db2:jcc");
public static final Dependency MARIADB_JDBC = Dependency.of("MariaDB JDBC Driver", "org.mariadb.jdbc:mariadb-java-client");
public static final Dependency MARIADB_R2DBC = Dependency.of("MariaDB R2DBC Driver", "rg.mariadb:r2dbc-mariadb");
public static final Dependency MS_SQLSERVER_JDBC = Dependency.of("Microsoft SqlServer JDBC Driver", "com.microsoft.sqlserver:mssql-jdbc");
public static final Dependency MS_SQLSERVER_R2DBC = Dependency.of("Microsoft SqlServer R2DBC Driver", "io.r2dbc:r2dbc-mssql");
public static final Dependency MYSQL_JDBC = Dependency.of("MySql JDBC Driver", "mysql:mysql-connector-java");
public static final Dependency MYSQL_R2DBC = Dependency.of("MySql R2DBC Driver", "io.asyncer:r2dbc-mysql");
public static final Dependency POSTGRES_JDBC = Dependency.of("Postgres JDBC Driver", "org.postgresql:postgresql");
public static final Dependency POSTGRES_R2DBC = Dependency.of("Postgres R2DBC Driver", "org.postgresql:r2dbc-postgresql");
public static final Dependency ORACLE_JDBC = Dependency.of("Oracle JDBC Driver", "com.oracle.database.jdbc:ojdbc11");
public static final Dependency ORACLE_R2DBC = Dependency.of("Oracle R2DBC Driver", "com.oracle.database.r2dbc:oracle-r2dbc");
static {
ReflectionUtils.doWithFields(Dependencies.class, field -> {

View File

@@ -75,6 +75,7 @@ import org.xmlbeam.io.StreamInput;
* Operations for dependency management.
*
* @author Mark Paluch
* @author Jens Schauder
*/
@Component
@RequiredArgsConstructor
@@ -476,7 +477,8 @@ public class DependencyOperations {
Dependency dependency = projectDependency.getDependency();
if (!(project == Projects.MONGO_DB && projectDependency.getProperty().equals("mongo.reactivestreams")
|| project == Projects.NEO4J || project == Projects.BUILD || project == Projects.JPA)) {
|| project == Projects.NEO4J || project == Projects.BUILD || project == Projects.JPA
|| project == Projects.RELATIONAL)) {
if (it.getDependencyVersion(dependency.getArtifactId()) == null
&& it.getManagedDependency(dependency.getArtifactId()) == null) {

View File

@@ -31,6 +31,7 @@ import org.springframework.util.MultiValueMap;
* Configuration of dependencies for a specific project.
*
* @author Mark Paluch
* @author Jens Schauder
*/
public class ProjectDependencies implements Streamable<ProjectDependencies.ProjectDependency> {
@@ -99,6 +100,22 @@ public class ProjectDependencies implements Streamable<ProjectDependencies.Proje
ProjectDependency.ofProperty("elasticsearch-java", Dependencies.ELASTICSEARCH_REST_CLIENT));
config.add(Projects.LDAP, ProjectDependency.ofProperty("spring-ldap", Dependencies.SPRING_LDAP));
config.add(Projects.RELATIONAL, ProjectDependency.ofProperty("h2.version", Dependencies.H2));
config.add(Projects.RELATIONAL, ProjectDependency.ofProperty("hsqldb.version", Dependencies.HSQLDB));
config.add(Projects.RELATIONAL, ProjectDependency.ofProperty("db2.version", Dependencies.DB2_JDBC));
config.add(Projects.RELATIONAL, ProjectDependency.ofProperty("mariadb-java-client.version", Dependencies.MARIADB_JDBC));
config.add(Projects.RELATIONAL, ProjectDependency.ofProperty("mssql.version", Dependencies.MS_SQLSERVER_JDBC));
config.add(Projects.RELATIONAL, ProjectDependency.ofProperty("mysql-connector-java.version", Dependencies.MYSQL_JDBC));
config.add(Projects.RELATIONAL, ProjectDependency.ofProperty("postgresql.version", Dependencies.POSTGRES_JDBC));
config.add(Projects.RELATIONAL, ProjectDependency.ofProperty("oracle.version", Dependencies.ORACLE_JDBC));
config.add(Projects.RELATIONAL, ProjectDependency.ofProperty("r2dbc-postgresql.version", Dependencies.POSTGRES_R2DBC));
config.add(Projects.RELATIONAL, ProjectDependency.ofProperty("r2dbc-h2.version", Dependencies.H2_R2DBC));
config.add(Projects.RELATIONAL, ProjectDependency.ofProperty("r2dbc-mariadb.version", Dependencies.MARIADB_R2DBC));
config.add(Projects.RELATIONAL, ProjectDependency.ofProperty("r2dbc-mssql.version", Dependencies.MS_SQLSERVER_R2DBC));
config.add(Projects.RELATIONAL, ProjectDependency.ofProperty("r2dbc-mysql.version", Dependencies.MYSQL_R2DBC));
config.add(Projects.RELATIONAL, ProjectDependency.ofProperty("oracle-r2dbc.version", Dependencies.ORACLE_R2DBC));
}
private final List<ProjectDependency> dependencies;