Skip to content

Commit

Permalink
Add database dependencies for Relational.
Browse files Browse the repository at this point in the history
The R2DBC dependencies are only found if they are defined in spring-data-relational, which is done by spring-projects/spring-data-relational#1892

Closes #97
  • Loading branch information
schauder authored and mp911de committed Sep 19, 2024
1 parent b6455f8 commit d7affa8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

/**
* @author Mark Paluch
* @author Jens Schauder
*/
public class Dependencies {

Expand Down Expand Up @@ -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 -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
* Operations for dependency management.
*
* @author Mark Paluch
* @author Jens Schauder
*/
@Component
@RequiredArgsConstructor
Expand Down Expand Up @@ -476,7 +477,8 @@ DependencyVersions getCurrentDependencies(SupportedProject supportedProject) {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* Configuration of dependencies for a specific project.
*
* @author Mark Paluch
* @author Jens Schauder
*/
public class ProjectDependencies implements Streamable<ProjectDependencies.ProjectDependency> {

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d7affa8

Please sign in to comment.