Example usage for org.apache.maven.project MavenProject getId

List of usage examples for org.apache.maven.project MavenProject getId

Introduction

In this page you can find the example usage for org.apache.maven.project MavenProject getId.

Prototype

public String getId() 

Source Link

Usage

From source file:org.eclipse.tycho.core.resolver.DefaultTargetPlatformConfigurationReader.java

License:Open Source License

private void addTargetEnvironments(TargetPlatformConfiguration result, MavenProject project,
        Xpp3Dom configuration) {/*from  www.  j  ava  2s . com*/
    TargetEnvironment deprecatedTargetEnvironmentSpec = getDeprecatedTargetEnvironment(configuration);
    if (deprecatedTargetEnvironmentSpec != null) {
        result.addEnvironment(deprecatedTargetEnvironmentSpec);
    }

    Xpp3Dom environmentsDom = configuration.getChild("environments");
    if (environmentsDom != null) {
        if (deprecatedTargetEnvironmentSpec != null) {
            String message = "Deprecated target-platform-configuration <environment> element must not be combined with new <environments> element; check the (inherited) configuration of "
                    + project.getId();
            throw new RuntimeException(message);
        }
        for (Xpp3Dom environmentDom : environmentsDom.getChildren("environment")) {
            result.addEnvironment(newTargetEnvironment(environmentDom));
        }
    }
}

From source file:org.efaps.maven_java5.EfapsAnnotationDescriptorExtractor.java

License:Open Source License

/**
 *
 * @param _project//  w  w w  .j  a va 2s  . c o m
 * @return
 * @throws InvalidPluginDescriptorException
 */
protected Map<String, Artifact> getManagedVersionMap(final MavenProject _project)
        throws InvalidPluginDescriptorException {

    final Map<String, Artifact> map = new HashMap<String, Artifact>();
    final DependencyManagement dependencyManagement = _project.getDependencyManagement();
    final String projectId = _project.getId();

    if ((dependencyManagement != null) && (dependencyManagement.getDependencies() != null)) {
        for (final Object obj : dependencyManagement.getDependencies()) {
            final Dependency d = (Dependency) obj;

            try {
                final VersionRange versionRange = VersionRange.createFromVersionSpec(d.getVersion());
                final Artifact artifact = this.artifactFactory.createDependencyArtifact(d.getGroupId(),
                        d.getArtifactId(), versionRange, d.getType(), d.getClassifier(), d.getScope(),
                        d.isOptional());
                map.put(d.getManagementKey(), artifact);
            } catch (final InvalidVersionSpecificationException e) {
                throw new InvalidPluginDescriptorException(
                        "Unable to parse version '" + d.getVersion() + "' for dependency '"
                                + d.getManagementKey() + "' in project " + projectId + " : " + e.getMessage(),
                        e);
            }
        }
    }
    return map;
}

From source file:org.guvnor.ala.build.maven.executor.MavenProjectConfigExecutor.java

License:Apache License

@Override
public Optional<ProjectConfig> apply(final Source source, final MavenProjectConfig mavenProjectConfig) {
    final Path projectRoot = source.getPath().resolve(mavenProjectConfig.getProjectDir());
    final InputStream pomStream = Files.newInputStream(projectRoot.resolve("pom.xml"));
    final MavenProject project = MavenProjectLoader.parseMavenPom(pomStream);

    final Collection<PlugIn> buildPlugins = extractPlugins(project);

    final String expectedBinary = project.getArtifact().getArtifactId() + "-"
            + project.getArtifact().getVersion() + "." + calculateExtension(project.getArtifact().getType());
    final String _tempDir = mavenProjectConfig.getProjectTempDir().trim();

    final RepositoryVisitor repositoryVisitor;
    if (_tempDir.isEmpty()) {
        repositoryVisitor = new RepositoryVisitor(projectRoot, project.getName());
    } else {//from w w w  .  ja v  a 2 s  .  c  o m
        repositoryVisitor = new RepositoryVisitor(projectRoot, _tempDir, mavenProjectConfig.recreateTempDir());
    }
    final org.guvnor.ala.build.maven.model.MavenProject mavenProject = new MavenProjectImpl(project.getId(),
            project.getArtifact().getType(), project.getName(), expectedBinary, source.getPath(),
            source.getPath().resolve(mavenProjectConfig.getProjectDir()),
            source.getPath().resolve("target").resolve(expectedBinary).toAbsolutePath(),
            repositoryVisitor.getRoot().getAbsolutePath(), buildPlugins);

    sourceRegistry.registerProject(source, mavenProject);

    return Optional.of(mavenProject);
}

From source file:org.hudsonci.maven.eventspy_30.handler.ProjectLogger.java

License:Open Source License

public static void log(MavenProject project, String where) {
    if (disabled)
        return;// w ww .  j  a v  a2 s .  c o m

    log.debug("MavenProject ({}) artifacts @ {}:", project.getId(), where);
    logArtifactContents("artifacts", project.getArtifacts());
    logArtifactContents("attachedArtifacts", project.getAttachedArtifacts());
    logArtifactContents("dependencyArtifacts", project.getDependencyArtifacts());
    logArtifactContents("extensionArtifacts", project.getExtensionArtifacts());
    logArtifactContents("pluginArtifacts", project.getPluginArtifacts());

    for (Artifact artifact : project.getPluginArtifacts()) {
        if (artifact instanceof PluginArtifact) {
            List<Dependency> dependencies = ((PluginArtifact) artifact).getDependencies();

            Integer maybeSize = (dependencies == null ? null : dependencies.size());
            log.debug("  {} " + "pluginDependencies" + ": {}", maybeSize, dependencies);
        }
    }
}

From source file:org.jboss.maven.extension.dependency.DependencyManagementLifecycleParticipant.java

License:Apache License

@Override
public void afterProjectsRead(MavenSession session) throws MavenExecutionException {
    // The dependency management overrider needs to know which projects
    // are in the reactor, and therefore should not be overridden.
    StringBuilder reactorProjects = new StringBuilder();
    for (MavenProject project : session.getProjects()) {
        reactorProjects.append(project.getGroupId() + ":" + project.getArtifactId() + ",");
    }/* ww  w .j a  v  a 2  s .  c o  m*/
    System.setProperty("reactorProjectGAs", reactorProjects.toString());

    // Apply model modifiers to the projects' models
    for (MavenProject project : session.getProjects()) {
        logger.debug("Checking project '" + project.getId() + "'");
        int modelChangeCount = 0;

        Model currModel = project.getModel();

        // Run the modifiers against the built model
        for (ModelModifier currModifier : afterProjectsReadModifierList) {
            boolean modelChanged = currModifier.updateModel(currModel);
            if (modelChanged) {
                modelChangeCount++;
            }
        }

        // If something changed, then it will be useful to output extra info
        if (sessionChangeCount >= 1 || modelChangeCount >= 1) {
            logger.debug("Session/Model changed at least once, writing informational files");
            try {
                MetaInfWriter.writeResource(currModel, new EffectivePomGenerator());
            } catch (IOException e) {
                logger.error(
                        "Could not write the effective POM of model '" + currModel.getId() + "' due to " + e);
            }
        }
    }

}

From source file:org.jszip.maven.RunMojo.java

License:Apache License

public void execute() throws MojoExecutionException, MojoFailureException {
    if (runPackages == null || runPackages.length == 0) {
        runPackages = new String[] { "war" };
    }//from   ww  w . j av  a2 s  . c  o  m

    injectMissingArtifacts(project, executedProject);

    if (!Arrays.asList(runPackages).contains(project.getPackaging())) {
        getLog().info("Skipping JSZip run: module "
                + ArtifactUtils.versionlessKey(project.getGroupId(), project.getArtifactId())
                + " as not specified in runPackages");
        return;
    }
    if (StringUtils.isNotBlank(runModule) && !project.getArtifactId().equals(runModule)
            && !ArtifactUtils.versionlessKey(project.getGroupId(), project.getArtifactId()).equals(runModule)) {
        getLog().info("Skipping JSZip run: module "
                + ArtifactUtils.versionlessKey(project.getGroupId(), project.getArtifactId())
                + " as requested runModule is " + runModule);
        return;
    }
    getLog().info("Starting JSZip run: module "
            + ArtifactUtils.versionlessKey(project.getGroupId(), project.getArtifactId()));
    MavenProject project = this.project;
    long lastResourceChange = System.currentTimeMillis();
    long lastClassChange = System.currentTimeMillis();
    long lastPomChange = getPomsLastModified();

    Server server = new Server();
    if (connectors == null || connectors.length == 0) {
        SelectChannelConnector selectChannelConnector = new SelectChannelConnector();
        selectChannelConnector.setPort(8080);
        connectors = new Connector[] { selectChannelConnector };
    }
    server.setConnectors(connectors);
    ContextHandlerCollection contexts = new ContextHandlerCollection();
    HandlerCollection handlerCollection = new HandlerCollection(true);
    DefaultHandler defaultHandler = new DefaultHandler();
    handlerCollection.setHandlers(new Handler[] { contexts, defaultHandler });
    server.setHandler(handlerCollection);
    try {
        server.start();
    } catch (Exception e) {
        throw new MojoExecutionException(e.getMessage(), e);
    }
    List<MavenProject> reactorProjects = this.reactorProjects;
    WebAppContext webAppContext;
    Resource webXml;
    List<Resource> resources;
    try {
        resources = new ArrayList<Resource>();
        addCssEngineResources(project, reactorProjects, mappings, resources);
        for (Artifact a : getOverlayArtifacts(project, scope)) {
            addOverlayResources(reactorProjects, resources, a);
        }
        if (warSourceDirectory == null) {
            warSourceDirectory = new File(project.getBasedir(), "src/main/webapp");
        }
        if (warSourceDirectory.isDirectory()) {
            resources.add(Resource.newResource(warSourceDirectory));
        }
        Collections.reverse(resources);
        getLog().debug("Overlays:");
        int index = 0;
        for (Resource r : resources) {
            getLog().debug("  [" + index++ + "] = " + r);
        }
        final ResourceCollection resourceCollection = new ResourceCollection(
                resources.toArray(new Resource[resources.size()]));

        webAppContext = new JettyWebAppContext();
        webAppContext.setWar(warSourceDirectory.getAbsolutePath());
        webAppContext.setBaseResource(resourceCollection);

        WebAppClassLoader classLoader = new WebAppClassLoader(webAppContext);
        for (String s : getClasspathElements(project, scope)) {
            classLoader.addClassPath(s);
        }
        webAppContext.setClassLoader(classLoader);

        contexts.setHandlers(new Handler[] { webAppContext });
        contexts.start();
        webAppContext.start();
        Resource webInf = webAppContext.getWebInf();
        webXml = webInf != null ? webInf.getResource("web.xml") : null;
    } catch (MojoExecutionException e) {
        throw e;
    } catch (MojoFailureException e) {
        throw e;
    } catch (ArtifactFilterException e) {
        throw new MojoExecutionException(e.getMessage(), e);
    } catch (MalformedURLException e) {
        throw new MojoExecutionException(e.getMessage(), e);
    } catch (IOException e) {
        throw new MojoExecutionException(e.getMessage(), e);
    } catch (Exception e) {
        throw new MojoExecutionException(e.getMessage(), e);
    }

    long webXmlLastModified = webXml == null ? 0L : webXml.lastModified();
    try {

        getLog().info("Context started. Will restart if changes to poms detected.");
        long nextClasspathCheck = System.currentTimeMillis() + classpathCheckInterval;
        while (true) {
            long nextCheck = System.currentTimeMillis() + 500;
            long pomsLastModified = getPomsLastModified();
            boolean pomsChanged = lastPomChange < pomsLastModified;
            boolean overlaysChanged = false;
            boolean classPathChanged = webXmlLastModified < (webXml == null ? 0L : webXml.lastModified());
            if (nextClasspathCheck < System.currentTimeMillis()) {
                long classChange = classpathLastModified(project);
                if (classChange > lastClassChange) {
                    classPathChanged = true;
                    lastClassChange = classChange;
                }
                nextClasspathCheck = System.currentTimeMillis() + classpathCheckInterval;
            }
            if (!classPathChanged && !overlaysChanged && !pomsChanged) {

                try {
                    lastResourceChange = processResourceSourceChanges(reactorProjects, project,
                            lastResourceChange);
                } catch (ArtifactFilterException e) {
                    getLog().debug("Couldn't process resource changes", e);
                }
                try {
                    Thread.sleep(Math.max(100L, nextCheck - System.currentTimeMillis()));
                } catch (InterruptedException e) {
                    getLog().debug("Interrupted", e);
                }
                continue;
            }
            if (pomsChanged) {
                getLog().info("Change in poms detected, re-parsing to evaluate impact...");
                // we will now process this change,
                // so from now on don't re-process
                // even if we have issues processing
                lastPomChange = pomsLastModified;
                List<MavenProject> newReactorProjects;
                try {
                    newReactorProjects = buildReactorProjects();
                } catch (ProjectBuildingException e) {
                    getLog().info("Re-parse aborted due to malformed pom.xml file(s)", e);
                    continue;
                } catch (CycleDetectedException e) {
                    getLog().info("Re-parse aborted due to dependency cycle in project model", e);
                    continue;
                } catch (DuplicateProjectException e) {
                    getLog().info("Re-parse aborted due to duplicate projects in project model", e);
                    continue;
                } catch (Exception e) {
                    getLog().info("Re-parse aborted due a problem that prevented sorting the project model", e);
                    continue;
                }
                if (!buildPlanEqual(newReactorProjects, this.reactorProjects)) {
                    throw new BuildPlanModifiedException("A pom.xml change has impacted the build plan.");
                }
                MavenProject newProject = findProject(newReactorProjects, this.project);
                if (newProject == null) {
                    throw new BuildPlanModifiedException("A pom.xml change appears to have removed "
                            + this.project.getId() + " from the build plan.");
                }

                newProject.setArtifacts(resolve(newProject, "runtime"));

                getLog().debug("Comparing effective classpath of new and old models");
                try {
                    classPathChanged = classPathChanged || classpathsEqual(project, newProject, scope);
                } catch (DependencyResolutionRequiredException e) {
                    getLog().info("Re-parse aborted due to dependency resolution problems", e);
                    continue;
                }
                if (classPathChanged) {
                    getLog().info("Effective classpath of " + project.getId() + " has changed.");
                } else {
                    getLog().debug("Effective classpath is unchanged.");
                }

                getLog().debug("Comparing effective overlays of new and old models");
                try {
                    overlaysChanged = overlaysEqual(project, newProject);
                } catch (OverConstrainedVersionException e) {
                    getLog().info("Re-parse aborted due to dependency resolution problems", e);
                    continue;
                } catch (ArtifactFilterException e) {
                    getLog().info("Re-parse aborted due to overlay resolution problems", e);
                    continue;
                }
                if (overlaysChanged) {
                    getLog().info("Overlay modules of " + project.getId() + " have changed.");
                } else {
                    getLog().debug("Overlay modules are unchanged.");
                }

                getLog().debug("Comparing overlays paths of new and old models");
                try {
                    List<Resource> newResources = new ArrayList<Resource>();
                    // TODO newMappings
                    addCssEngineResources(newProject, newReactorProjects, mappings, resources);
                    for (Artifact a : getOverlayArtifacts(project, scope)) {
                        addOverlayResources(newReactorProjects, newResources, a);
                    }
                    if (warSourceDirectory.isDirectory()) {
                        newResources.add(Resource.newResource(warSourceDirectory));
                    }
                    Collections.reverse(newResources);
                    getLog().debug("New overlays:");
                    int index = 0;
                    for (Resource r : newResources) {
                        getLog().debug("  [" + index++ + "] = " + r);
                    }
                    boolean overlayPathsChanged = !resources.equals(newResources);
                    if (overlayPathsChanged) {
                        getLog().info("Overlay module paths of " + project.getId() + " have changed.");
                    } else {
                        getLog().debug("Overlay module paths are unchanged.");
                    }
                    overlaysChanged = overlaysChanged || overlayPathsChanged;
                } catch (ArtifactFilterException e) {
                    getLog().info("Re-parse aborted due to overlay evaluation problems", e);
                    continue;
                } catch (PluginConfigurationException e) {
                    getLog().info("Re-parse aborted due to overlay evaluation problems", e);
                    continue;
                } catch (PluginContainerException e) {
                    getLog().info("Re-parse aborted due to overlay evaluation problems", e);
                    continue;
                } catch (IOException e) {
                    getLog().info("Re-parse aborted due to overlay evaluation problems", e);
                    continue;
                }

                project = newProject;
                reactorProjects = newReactorProjects;
            }

            if (!overlaysChanged && !classPathChanged) {
                continue;
            }
            getLog().info("Restarting context to take account of changes...");
            try {
                webAppContext.stop();
            } catch (Exception e) {
                throw new MojoExecutionException(e.getMessage(), e);
            }

            if (classPathChanged) {
                getLog().info("Updating classpath...");
                try {
                    WebAppClassLoader classLoader = new WebAppClassLoader(webAppContext);
                    for (String s : getClasspathElements(project, scope)) {
                        classLoader.addClassPath(s);
                    }
                    webAppContext.setClassLoader(classLoader);
                } catch (Exception e) {
                    throw new MojoExecutionException(e.getMessage(), e);
                }
            }

            if (overlaysChanged || classPathChanged) {
                getLog().info("Updating overlays...");
                try {
                    resources = new ArrayList<Resource>();
                    addCssEngineResources(project, reactorProjects, mappings, resources);
                    for (Artifact a : getOverlayArtifacts(project, scope)) {
                        addOverlayResources(reactorProjects, resources, a);
                    }
                    if (warSourceDirectory.isDirectory()) {
                        resources.add(Resource.newResource(warSourceDirectory));
                    }
                    Collections.reverse(resources);
                    getLog().debug("Overlays:");
                    int index = 0;
                    for (Resource r : resources) {
                        getLog().debug("  [" + index++ + "] = " + r);
                    }
                    final ResourceCollection resourceCollection = new ResourceCollection(
                            resources.toArray(new Resource[resources.size()]));
                    webAppContext.setBaseResource(resourceCollection);
                } catch (Exception e) {
                    throw new MojoExecutionException(e.getMessage(), e);
                }
            }
            try {
                webAppContext.start();
            } catch (Exception e) {
                throw new MojoExecutionException(e.getMessage(), e);
            }
            webXmlLastModified = webXml == null ? 0L : webXml.lastModified();
            getLog().info("Context restarted.");
        }

    } finally {
        try {
            server.stop();
        } catch (Exception e) {
            throw new MojoExecutionException(e.getMessage(), e);
        }
    }
}

From source file:org.jszip.maven.RunMojo.java

License:Apache License

private MavenProject findProject(List<MavenProject> newReactorProjects, MavenProject oldProject) {
    final String targetId = oldProject.getId();
    for (MavenProject newProject : newReactorProjects) {
        if (targetId.equals(newProject.getId())) {
            return newProject;
        }//from   w  w w .ja  v a 2  s. c om
    }
    return null;
}

From source file:org.jszip.maven.RunMojo.java

License:Apache License

private boolean buildPlanEqual(List<MavenProject> newPlan, List<MavenProject> oldPlan) {
    if (newPlan.size() != oldPlan.size()) {
        return false;
    }/*from w  w w.j a  v  a 2  s .c o m*/
    int seq = 0;
    for (Iterator<MavenProject> i = newPlan.iterator(), j = oldPlan.iterator(); i.hasNext() && j.hasNext();) {
        MavenProject left = i.next();
        MavenProject right = j.next();
        getLog().debug("[" + (seq++) + "] = " + left.equals(right) + (left == right ? " same" : " diff") + " : "
                + left.getName() + "[" + left.getDependencies().size() + "], " + right.getName() + "["
                + right.getDependencies().size() + "]");
        if (!left.equals(right)) {
            return false;
        }
        if (left.getDependencies().size() != right.getDependencies().size()) {
            getLog().info("Dependency tree of " + left.getId() + " has been modified");
        }
    }
    return true;
}

From source file:org.jszip.maven.RunMojo.java

License:Apache License

private boolean overlaysEqual(MavenProject oldProject, MavenProject newProject)
        throws ArtifactFilterException, OverConstrainedVersionException {
    boolean overlaysChanged;
    Set<Artifact> newOA = getOverlayArtifacts(newProject, scope);
    Set<Artifact> oldOA = getOverlayArtifacts(oldProject, scope);
    overlaysChanged = newOA.size() != oldOA.size();
    for (Artifact n : newOA) {
        boolean found = false;
        for (Artifact o : oldOA) {
            if (StringUtils.equals(n.getArtifactId(), o.getArtifactId())
                    && StringUtils.equals(n.getGroupId(), o.getGroupId())) {
                if (o.getSelectedVersion().equals(n.getSelectedVersion())) {
                    found = true;//ww w  . ja v a  2 s .c o  m
                    break;
                }
            }
        }
        if (!found) {
            getLog().debug("added overlay artifact: " + n);
            overlaysChanged = true;
        }
    }
    for (Artifact o : oldOA) {
        boolean found = false;
        for (Artifact n : newOA) {
            if (StringUtils.equals(n.getArtifactId(), o.getArtifactId())
                    && StringUtils.equals(n.getGroupId(), o.getGroupId())) {
                if (o.getSelectedVersion().equals(n.getSelectedVersion())) {
                    found = true;
                    break;
                }
            }
        }
        if (!found) {
            getLog().debug("removed overlay artifact: " + o);
            overlaysChanged = true;
        }
    }
    if (overlaysChanged) {
        getLog().info("Effective overlays of " + oldProject.getId() + " have changed.");
    } else {
        getLog().debug("Effective overlays are unchanged.");
    }
    return overlaysChanged;
}

From source file:org.jvnet.hudson.plugins.mavendepsupdate.MavenUpdateChecker.java

License:Apache License

public MavenUpdateCheckerResult call() throws IOException {
    ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();

    try {/*from ww  w. j a v a2s .co m*/

        PluginFirstClassLoader pluginFirstClassLoader = getPluginFirstClassLoader();
        Thread.currentThread().setContextClassLoader(pluginFirstClassLoader);
        String classLoaderName = getClass().getClassLoader().toString();

        mavenUpdateCheckerResult.addDebugLine(classLoaderName);
        PlexusContainer plexusContainer = getPlexusContainer(pluginFirstClassLoader);

        Thread.currentThread().setContextClassLoader(plexusContainer.getContainerRealm());
        mavenUpdateCheckerResult.addDebugLine("ok for new DefaultPlexusContainer( conf ) ");
        mavenUpdateCheckerResult.addDebugLine("Thread.currentThread().getContextClassLoader() "
                + Thread.currentThread().getContextClassLoader());
        mavenUpdateCheckerResult.addDebugLine("Thread.currentThread().getContextClassLoader().parent "
                + (Thread.currentThread().getContextClassLoader().getParent() == null ? "null"
                        : Thread.currentThread().getContextClassLoader().getParent().toString()));
        mavenUpdateCheckerResult.addDebugLine(
                "classLoader  urls " + Arrays.asList(plexusContainer.getContainerRealm().getURLs()));
        ProjectBuilder projectBuilder = plexusContainer.lookup(ProjectBuilder.class);

        // FIXME load userProperties from the job
        Properties userProperties = this.userProperties == null ? new Properties() : this.userProperties;

        userProperties.put("java.home", jdkHome);

        ProjectBuildingRequest projectBuildingRequest = getProjectBuildingRequest(userProperties,
                plexusContainer);

        // check plugins too
        projectBuildingRequest.setProcessPlugins(true);
        // force snapshots update

        projectBuildingRequest.setResolveDependencies(true);

        List<ProjectBuildingResult> projectBuildingResults = projectBuilder
                .build(Arrays.asList(new File(rootPomPath)), true, projectBuildingRequest);

        ProjectDependenciesResolver projectDependenciesResolver = plexusContainer
                .lookup(ProjectDependenciesResolver.class);

        List<MavenProject> mavenProjects = new ArrayList<MavenProject>(projectBuildingResults.size());

        for (ProjectBuildingResult projectBuildingResult : projectBuildingResults) {
            mavenProjects.add(projectBuildingResult.getProject());
        }

        ProjectSorter projectSorter = new ProjectSorter(mavenProjects);

        // use the projects reactor model as a workspaceReader
        // if reactors are not available remotely dependencies resolve will failed
        // due to artifact not found

        final Map<String, MavenProject> projectMap = getProjectMap(mavenProjects);
        WorkspaceReader reactorRepository = new ReactorReader(projectMap);

        MavenRepositorySystemSession mavenRepositorySystemSession = (MavenRepositorySystemSession) projectBuildingRequest
                .getRepositorySession();

        mavenRepositorySystemSession.setUpdatePolicy(RepositoryPolicy.UPDATE_POLICY_ALWAYS);

        mavenRepositorySystemSession.setWorkspaceReader(reactorRepository);

        MavenPluginManager mavenPluginManager = plexusContainer.lookup(MavenPluginManager.class);

        for (MavenProject mavenProject : projectSorter.getSortedProjects()) {
            LOGGER.info("resolve dependencies for project " + mavenProject.getId());

            DefaultDependencyResolutionRequest dependencyResolutionRequest = new DefaultDependencyResolutionRequest(
                    mavenProject, mavenRepositorySystemSession);

            try {
                DependencyResolutionResult dependencyResolutionResult = projectDependenciesResolver
                        .resolve(dependencyResolutionRequest);
            } catch (DependencyResolutionException e) {
                mavenUpdateCheckerResult.addDebugLine(e.getMessage());
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                e.printStackTrace(pw);
                mavenUpdateCheckerResult.addDebugLine("skip:" + sw.toString());
            }
            if (checkPlugins) {
                for (Plugin plugin : mavenProject.getBuildPlugins()) {
                    // only for SNAPSHOT
                    if (StringUtils.endsWith(plugin.getVersion(), "SNAPSHOT")) {
                        mavenPluginManager.getPluginDescriptor(plugin,
                                mavenProject.getRemotePluginRepositories(), mavenRepositorySystemSession);
                    }
                }
            }

        }
        SnapshotTransfertListener snapshotTransfertListener = (SnapshotTransfertListener) projectBuildingRequest
                .getRepositorySession().getTransferListener();

        if (snapshotTransfertListener.isSnapshotDownloaded()) {
            mavenUpdateCheckerResult.addFilesUpdatedNames(snapshotTransfertListener.getSnapshots());
        }

    } catch (Exception e) {
        mavenUpdateCheckerResult.addDebugLine(e.getMessage());
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        e.printStackTrace(pw);
        mavenUpdateCheckerResult.addDebugLine("skip:" + sw.toString());
    } finally {
        Thread.currentThread().setContextClassLoader(originalClassLoader);
    }
    return mavenUpdateCheckerResult;
}