diff --git a/.gitignore b/.gitignore index cb452cd1c..6930429b4 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ /docs/mdbook_bin /shotover-proxy/build/packages /some_local_file -/test-helpers/src/connection/kafka/node/node_modules \ No newline at end of file +/test-helpers/src/connection/kafka/node/node_modules +/test-helpers/j4rs \ No newline at end of file diff --git a/test-helpers/Cargo.toml b/test-helpers/Cargo.toml index c0cb615a5..c07f36a17 100644 --- a/test-helpers/Cargo.toml +++ b/test-helpers/Cargo.toml @@ -42,3 +42,6 @@ rustls-pemfile = "2.0.0" tokio-tungstenite = { version = "0.24", features = ["rustls-tls-native-roots"] } pretty_assertions.workspace = true serde.workspace = true + +[build-dependencies] +j4rs = "0.21.0" \ No newline at end of file diff --git a/test-helpers/build.rs b/test-helpers/build.rs new file mode 100644 index 000000000..21a84f431 --- /dev/null +++ b/test-helpers/build.rs @@ -0,0 +1,5 @@ +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + + j4rs::Jvm::copy_j4rs_libs_under("j4rs").unwrap(); +} diff --git a/test-helpers/src/connection/java.rs b/test-helpers/src/connection/java.rs index 25ac455c9..ee9c34fc2 100644 --- a/test-helpers/src/connection/java.rs +++ b/test-helpers/src/connection/java.rs @@ -11,7 +11,12 @@ impl Jvm { /// Construct a JVM, downloads the list of deps from the maven repository. /// Example dep string: "org.slf4j:slf4j-api:1.7.36" pub(crate) fn new(deps: &[&str]) -> Self { - let jvm = Rc::new(JvmBuilder::new().build().unwrap()); + let jvm = Rc::new( + JvmBuilder::new() + .with_base_path("../test-helpers/j4rs") + .build() + .unwrap(), + ); for dep in deps { jvm.deploy_artifact(&MavenArtifact::from(*dep)).unwrap();