void (MavenProject project, List<Exception> exceptions) { ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); Collection<AbstractMavenLifecycleParticipant> lifecycleParticipants = getLifecycleParticipants(Collections.singletonList(project)); if (!lifecycleParticipants.isEmpty()) { LegacySupport legacySupport = myEmbedder.getComponent(LegacySupport.class); MavenSession session = legacySupport.getSession(); if (null != session) { session.setCurrentProject(project); try { // the method can be removed session.setAllProjects(Collections.singletonList(project)); } catch (NoSuchMethodError ignore) { } session.setProjects(Collections.singletonList(project)); for (AbstractMavenLifecycleParticipant listener : lifecycleParticipants) { Thread.currentThread().setContextClassLoader(listener.getClass().getClassLoader()); try { listener.afterProjectsRead(session); } catch (Exception e) { exceptions.add(e); } finally { Thread.currentThread().setContextClassLoader(originalClassLoader); } } } } }