Skip to content

Commit c10d19e

Browse files
committed
try to initialize maven in tests in a synchronized manner
1 parent 73e459f commit c10d19e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tmc-langs-java/src/maven.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,22 @@ impl JavaPlugin for MavenPlugin {
249249
mod test {
250250
use super::super::{TestCase, TestCaseStatus};
251251
use super::*;
252+
use std::sync::Once;
252253
use tempfile::{tempdir, TempDir};
253254
use tmc_langs_framework::plugin::Strategy;
254255
use walkdir::WalkDir;
255256

257+
static INIT_MAVEN: Once = Once::new();
258+
256259
fn init() {
257260
let _ = env_logger::builder().is_test(true).try_init();
261+
262+
// initializes maven in a synchronized manner for all tests
263+
#[cfg(windows)]
264+
INIT_MAVEN.call_once(|| {
265+
let mvn = MavenPlugin::new().expect("failed to init maven");
266+
mvn.get_mvn_command().expect("failed to get mvn command");
267+
});
258268
}
259269

260270
fn copy_test_dir(path: &str) -> TempDir {

0 commit comments

Comments
 (0)