From 41e71f6b10ede42198c4fbb411bbb084e1f672bb Mon Sep 17 00:00:00 2001 From: Sheng Chen Date: Mon, 24 Jan 2022 11:14:34 +0800 Subject: [PATCH] fix: Should setup TestNG correctly (#1362) Signed-off-by: Sheng Chen --- src/commands/testDependenciesCommands.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/commands/testDependenciesCommands.ts b/src/commands/testDependenciesCommands.ts index 67bb90b8..98e0d1db 100644 --- a/src/commands/testDependenciesCommands.ts +++ b/src/commands/testDependenciesCommands.ts @@ -159,6 +159,10 @@ function getJarIds(testKind: TestKind): IArtifactMetadata[] { groupId: 'com.beust', artifactId: 'jcommander', defaultVersion: '1.81', + }, { + groupId: 'org.slf4j', + artifactId: 'slf4j-api', + defaultVersion: '1.7.33', }]; default: return []; @@ -255,9 +259,11 @@ async function updateProjectSettings(projectUri: Uri, libFolder: string): Promis let referencedLibraries: any = configuration.get('project.referencedLibraries'); if (_.isArray(referencedLibraries)) { referencedLibraries.push(testDependencies); + referencedLibraries = Array.from(new Set(referencedLibraries)); } else if (_.isObject(referencedLibraries)) { referencedLibraries = referencedLibraries as {include: string[]}; referencedLibraries.include.push(testDependencies); + referencedLibraries.include = Array.from(new Set(referencedLibraries.include)); if (!referencedLibraries.exclude && !referencedLibraries.sources) { referencedLibraries = referencedLibraries.include; }