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

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

Introduction

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

Prototype

public List<Extension> getBuildExtensions() 

Source Link

Usage

From source file:hudson.gridmaven.PomInfo.java

License:Open Source License

public PomInfo(MavenProject project, PomInfo parent, String relPath) {
    this.name = new ModuleName(project);
    this.version = project.getVersion();
    this.displayName = project.getName();
    this.defaultGoal = project.getDefaultGoal();
    this.relativePath = relPath;
    this.parent = parent;
    if (parent != null)
        parent.children.add(name);/*  w w w.  ja  v  a  2s  . c o m*/

    for (Dependency dep : (List<Dependency>) project.getDependencies())
        dependencies.add(new ModuleDependency(dep));

    MavenProject parentProject = project.getParent();
    if (parentProject != null)
        dependencies.add(new ModuleDependency(parentProject));
    if (parent != null)
        dependencies.add(parent.asDependency());

    addPluginsAsDependencies(project.getBuildPlugins(), dependencies);
    addReportPluginsAsDependencies(project.getReportPlugins(), dependencies);

    List<Extension> extensions = project.getBuildExtensions();
    if (extensions != null)
        for (Extension ext : extensions)
            dependencies.add(new ModuleDependency(ext));

    // when the parent POM uses a plugin and builds a plugin at the same time,
    // the plugin module ends up depending on itself
    dependencies.remove(asDependency());

    CiManagement ciMgmt = project.getCiManagement();
    if ((ciMgmt != null) && (ciMgmt.getSystem() == null || ciMgmt.getSystem().equals("hudson"))) {
        Notifier mailNotifier = null;
        for (Notifier n : (List<Notifier>) ciMgmt.getNotifiers()) {
            if (n.getType().equals("mail")) {
                mailNotifier = n;
                break;
            }
        }
        this.mailNotifier = mailNotifier;
    } else
        this.mailNotifier = null;

    this.groupId = project.getGroupId();
    this.artifactId = project.getArtifactId();
    this.packaging = project.getPackaging();
}

From source file:org.debian.dependency.DefaultDependencyCollection.java

License:Apache License

private void visitBuildExtensions(final DependencyNodeVisitor visitor, final MavenProject project,
        final ArtifactFilter filter, final MavenSession session) throws DependencyResolutionException {
    for (Extension extension : project.getBuildExtensions()) {
        Artifact artifact = repositorySystem.createProjectArtifact(extension.getGroupId(),
                extension.getArtifactId(), extension.getVersion());
        if (filter != null && !filter.include(artifact)) {
            continue;
        }/*from   w  w w .  j a v a 2s .  c om*/

        DependencyNode extensionDependencies = resolveProjectDependencies(extension.getGroupId(),
                extension.getArtifactId(), extension.getVersion(), filter, session);
        extensionDependencies.accept(visitor);
    }
}

From source file:org.jetbrains.maven.embedder.MavenEmbedder.java

License:Apache License

private void findExtensions(MavenProject project) {
    // end copied from DefaultLifecycleExecutor.findExtensions
    ExtensionManager extensionManager = getComponent(ExtensionManager.class);
    for (Object each : project.getBuildExtensions()) {
        try {//from ww w .  jav a  2 s .c o m
            extensionManager.addExtension((Extension) each, project, myLocalRepository);
        } catch (PlexusContainerException e) {
            MavenEmbedderLog.LOG.error(e);
        } catch (ArtifactResolutionException e) {
            MavenEmbedderLog.LOG.error(e);
        } catch (ArtifactNotFoundException e) {
            MavenEmbedderLog.LOG.error(e);
        }
    }
    extensionManager.registerWagons();

    Map handlers = findArtifactTypeHandlers(project);
    getComponent(ArtifactHandlerManager.class).addHandlers(handlers);
}