Skip to content

Commit

Permalink
Fix dependencies in :nessie-compatibility-common (#6055)
Browse files Browse the repository at this point in the history
"implementation" dependency on In-Memory and RocksDB adapters is
required because `OlderNessieClientsExtension` and
`NessieUpgradesExtension` load them dynamically in runtime.

Switch main artifact from :nessie-jaxrs to :nessie-compatibility-common
after 0.48.1 because dependencies were rearranged. 0.47.1 itself is not
really usable with the "compatibility" test framework, but adding
workarounds for it does not look worth the while. The next version
should be usable.
  • Loading branch information
dimas-b authored Feb 8, 2023
1 parent 29bd4db commit a44b47e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
8 changes: 4 additions & 4 deletions compatibility/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ dependencies {
testImplementation(libs.mockito.core)
testImplementation(libs.guava)
testImplementation(project(":nessie-versioned-persist-non-transactional-test"))
testImplementation(project(":nessie-versioned-persist-in-memory"))
testImplementation(project(":nessie-versioned-persist-in-memory-test"))
testImplementation(project(":nessie-versioned-persist-rocks"))
testImplementation(project(":nessie-versioned-persist-rocks-test"))
implementation(project(":nessie-versioned-persist-in-memory"))
implementation(project(":nessie-versioned-persist-in-memory-test"))
implementation(project(":nessie-versioned-persist-rocks"))
implementation(project(":nessie-versioned-persist-rocks-test"))
compileOnly(project(":nessie-versioned-persist-mongodb-test"))

testImplementation(libs.junit.platform.testkit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public class Version implements Comparable<Version> {
// declaring an explicit dependency in its POM.
public static final Version CLIENT_LOG4J_UNDECLARED_LOW = Version.parseVersion("0.46.0");
public static final Version CLIENT_LOG4J_UNDECLARED_HIGH = Version.parseVersion("0.47.1");
// COMPAT_COMMON_DEPENDENCIES_START is the version where dependency declarations for
// "compatibility" tests moved to :nessie-compatibility-common
public static final Version COMPAT_COMMON_DEPENDENCIES_START = Version.parseVersion("0.48.2");

public static final String CURRENT_STRING = "current";
public static final String NOT_CURRENT_STRING = "not-current";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.projectnessie.tools.compatibility.internal;

import static org.projectnessie.tools.compatibility.api.Version.COMPAT_COMMON_DEPENDENCIES_START;
import static org.projectnessie.tools.compatibility.api.Version.VERSIONED_REST_URI_START;
import static org.projectnessie.tools.compatibility.internal.DependencyResolver.resolve;
import static org.projectnessie.tools.compatibility.internal.DependencyResolver.toClassLoader;
Expand Down Expand Up @@ -131,10 +132,16 @@ static ClassLoader createSharedClassLoader() {
}

static ClassLoader createClassLoader(Version version, ClassLoader sharedClassLoader) {
// Use 'nessie-jaxrs' because it has all the necessary dependencies to the DatabaseAdapter
// implementations, REST services, Version store implementation, etc.
// The 'nessie-jaxrs' has all the necessary dependencies to the DatabaseAdapter
// implementations, REST services, Version store implementation, etc. in older versions.
// Newer versions declare what is required as runtime dependencies of
// `nessie-compatibility-common`
String artifactId =
version.isGreaterThanOrEqual(COMPAT_COMMON_DEPENDENCIES_START)
? "nessie-compatibility-common"
: "nessie-jaxrs";
try {
return oldNessieClassLoader(version, "nessie-jaxrs");
return oldNessieClassLoader(version, artifactId);
} catch (DependencyResolutionException e) {
throw new RuntimeException(
"Failed to resolve dependencies for Nessie server version " + version, e);
Expand Down

0 comments on commit a44b47e

Please sign in to comment.