1919import java .util .ArrayList ;
2020import java .util .List ;
2121import java .util .Map ;
22+ import java .util .Optional ;
2223import java .util .concurrent .CompletableFuture ;
2324import java .util .stream .Stream ;
2425
@@ -54,8 +55,8 @@ public MavenRuntimeClasspathProvider() {
5455 DidChangeConfigurationParams params = new DidChangeConfigurationParams (Map .of ("xml" , options ));
5556
5657 LanguageServers .forProject (null ).withPreferredServer (definition ).excludeInactive ()
57- .collectAll ((w , ls ) -> CompletableFuture .completedFuture (ls )).thenAccept (
58- lss -> lss . stream () .forEach (ls -> ls .getWorkspaceService ().didChangeConfiguration (params )));
58+ .collectAll ((w , ls ) -> CompletableFuture .completedFuture (ls )).thenAccept (lss -> lss . stream ()
59+ .forEach (ls -> ls .getWorkspaceService ().didChangeConfiguration (params )));
5960
6061 };
6162 MavenPlugin .getMavenConfiguration ().addConfigurationChangeListener (mavenConfigurationlistener );
@@ -70,12 +71,9 @@ public List<File> get() {
7071 addJarsFromBundle (FrameworkUtil .getBundle (org .apache .maven .Maven .class ), "/jars/" , mavenRuntimeJars );
7172 // Libraries that are also required and not included in
7273 // org.eclipse.m2e.maven.runtime
73- try {
74- mavenRuntimeJars .add (FileLocator .getBundleFile (FrameworkUtil .getBundle (javax .inject .Inject .class )));
75- mavenRuntimeJars .add (FileLocator .getBundleFile (FrameworkUtil .getBundle (org .slf4j .Logger .class )));
76- } catch (IOException e ) {
77- LOG .error (e .getMessage (), e );
78- }
74+ Stream .of (javax .inject .Inject .class , org .slf4j .Logger .class )//
75+ .map (FrameworkUtil ::getBundle ).map (FileLocator ::getBundleFileLocation )//
76+ .flatMap (Optional ::stream ).forEach (mavenRuntimeJars ::add );
7977 return mavenRuntimeJars ;
8078 }
8179
0 commit comments