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

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

Introduction

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

Prototype

public String getName() 

Source Link

Usage

From source file:org.gephi.maven.Validate.java

License:Apache License

private void checkGephiVersion(MavenProject moduleProject) throws MojoExecutionException {
    String moduleVersion = moduleProject.getProperties().getProperty("gephi.version");
    String projectVersion = project.getProperties().getProperty("gephi.version");
    if (!moduleVersion.equals(projectVersion)) {
        getLog().warn("The project '" + moduleProject.getName() + "' depends on Gephi version '" + moduleVersion
                + "' but '" + projectVersion + "' is expected, it will be ignored");
    }/*from ww w.  ja  v  a  2  s  . com*/
}

From source file:org.grumblesmurf.malabar.ExecutionEventLogger.java

License:Apache License

@Override
public void sessionStarted(ExecutionEvent event) {
    if (logger.isInfoEnabled() && event.getSession().getProjects().size() > 1) {
        logHeader("Reactor Build Order:");
        for (MavenProject project : event.getSession().getProjects()) {
            logger.info(project.getName());
        }/*from  w  ww.  ja v  a  2  s .  c  o  m*/
    }
}

From source file:org.grumblesmurf.malabar.ExecutionEventLogger.java

License:Apache License

private void logReactorSummary(MavenSession session) {
    logHeader("Reactor Summary:");

    MavenExecutionResult result = session.getResult();

    for (MavenProject project : session.getProjects()) {
        StringBuilder buffer = new StringBuilder(128);

        buffer.append(project.getName());

        buffer.append(' ');
        while (buffer.length() < SEPARATOR.length() - 21) {
            buffer.append('.');
        }//from ww w.j  a  v  a  2 s.c  o m
        buffer.append(' ');

        BuildSummary buildSummary = result.getBuildSummary(project);

        if (buildSummary == null) {
            buffer.append("SKIPPED");
        } else if (buildSummary instanceof BuildSuccess) {
            buffer.append("SUCCESS [");
            buffer.append(getFormattedTime(buildSummary.getTime()));
            buffer.append("]");
        } else if (buildSummary instanceof BuildFailure) {
            buffer.append("FAILURE [");
            buffer.append(getFormattedTime(buildSummary.getTime()));
            buffer.append("]");
        }

        logger.info(buffer.toString());
    }
}

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 {/*w  w  w .j a  va 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.hsc.novelSpider.bundleplugin.BundlePlugin.java

License:Apache License

protected Properties getDefaultProperties(MavenProject currentProject) {
    Properties properties = new Properties();

    String bsn;/*from  www.  j  av a2 s  .c  om*/
    try {
        bsn = getMaven2OsgiConverter().getBundleSymbolicName(currentProject.getArtifact());
    } catch (Exception e) {
        bsn = currentProject.getGroupId() + "." + currentProject.getArtifactId();
    }

    // Setup defaults
    properties.put(MAVEN_SYMBOLICNAME, bsn);
    properties.put(Analyzer.BUNDLE_SYMBOLICNAME, bsn);
    properties.put(Analyzer.IMPORT_PACKAGE, "*");
    properties.put(Analyzer.BUNDLE_VERSION, getMaven2OsgiConverter().getVersion(currentProject.getVersion()));

    // remove the extraneous Include-Resource and Private-Package entries from generated manifest
    properties.put(Constants.REMOVEHEADERS, Analyzer.INCLUDE_RESOURCE + ',' + Analyzer.PRIVATE_PACKAGE);

    header(properties, Analyzer.BUNDLE_DESCRIPTION, currentProject.getDescription());
    StringBuffer licenseText = printLicenses(currentProject.getLicenses());
    if (licenseText != null) {
        header(properties, Analyzer.BUNDLE_LICENSE, licenseText);
    }
    header(properties, Analyzer.BUNDLE_NAME, currentProject.getName());

    if (currentProject.getOrganization() != null) {
        if (currentProject.getOrganization().getName() != null) {
            String organizationName = currentProject.getOrganization().getName();
            header(properties, Analyzer.BUNDLE_VENDOR, organizationName);
            properties.put("project.organization.name", organizationName);
            properties.put("pom.organization.name", organizationName);
        }
        if (currentProject.getOrganization().getUrl() != null) {
            String organizationUrl = currentProject.getOrganization().getUrl();
            header(properties, Analyzer.BUNDLE_DOCURL, organizationUrl);
            properties.put("project.organization.url", organizationUrl);
            properties.put("pom.organization.url", organizationUrl);
        }
    }

    properties.putAll(currentProject.getProperties());
    properties.putAll(currentProject.getModel().getProperties());
    if (m_mavenSession != null) {
        try {
            // don't pass upper-case session settings to bnd as they end up in the manifest
            Properties sessionProperties = m_mavenSession.getExecutionProperties();
            for (Enumeration e = sessionProperties.propertyNames(); e.hasMoreElements();) {
                String key = (String) e.nextElement();
                if (key.length() > 0 && !Character.isUpperCase(key.charAt(0))) {
                    properties.put(key, sessionProperties.getProperty(key));
                }
            }
        } catch (Exception e) {
            getLog().warn("Problem with Maven session properties: " + e.getLocalizedMessage());
        }
    }

    properties.putAll(getProperties(currentProject.getModel(), "project.build."));
    properties.putAll(getProperties(currentProject.getModel(), "pom."));
    properties.putAll(getProperties(currentProject.getModel(), "project."));

    properties.put("project.baseDir", getBase(currentProject));
    properties.put("project.build.directory", getBuildDirectory());
    properties.put("project.build.outputdirectory", getOutputDirectory());

    properties.put("classifier", classifier == null ? "" : classifier);

    getLog().info("BlueprintPlugin");
    // Add default plugins
    header(properties, Analyzer.PLUGIN, SpringXMLType.class.getName());
    //header( properties, Analyzer.PLUGIN, BlueprintPlugin.class.getName() + "," + SpringXMLType.class.getName() );

    return properties;
}

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

License:Open Source License

@SuppressWarnings("unused")
public static void log(final ExecutionEvent event) {
    if (disabled)
        return;/* w  ww .  j ava2 s.  c  o m*/

    for (MavenProject project : event.getSession().getProjects()) {
        log.debug("*** Examining profiles for {}.", project.getName());
        logProfileList(project.getActiveProfiles(), "active");
        logProfileList(project.getModel().getProfiles(), "model");

        //logProfiles( event.getSession().getProjectBuildingRequest().getProfiles(), "ProjectBuildingRequest" );
        logProfileList(project.getProjectBuildingRequest().getProfiles(), "ProjectBuildingRequest");

        log.debug("InjectedProfileIds");
        for (Entry<String, List<String>> entry : project.getInjectedProfileIds().entrySet()) {
            log.debug("  from {} are {}", entry.getKey(), entry.getValue());
        }

        Settings settings = event.getSession().getSettings();
        logSettingsProfileList(settings.getProfiles(), "session-settings");

        log.debug("Collected projects: {}", project.getCollectedProjects());
        log.debug("Project references: {}", project.getProjectReferences());
    }
}

From source file:org.hudsonci.maven.eventspy_30.MavenProjectConverter.java

License:Open Source License

public static MavenProjectDTO convertMavenProject(final MavenProject mavenProject) {
    checkNotNull(mavenProject);/*from  w  ww . ja  v a  2s. c  o m*/

    MavenProjectDTO projectDTO = new MavenProjectDTO().withName(mavenProject.getName())
            .withCoordinates(asCoordinates(mavenProject))
            .withProfiles(convertProfiles(ProfileCollector.collect(mavenProject)));

    return projectDTO;
}

From source file:org.impalaframework.maven.plugin.MojoUtils.java

License:Apache License

static String getModuleStagingDirectory(Log log, MavenProject project, String moduleStagingDirectory)
        throws MojoExecutionException {

    //FIXME test//from   w  ww. ja v  a2 s . com

    String parentName = null;

    if (moduleStagingDirectory == null) {
        MavenProject parent = project.getParent();
        if (parent != null) {
            parentName = parent.getName();
            final String parentOutputDirectory = parent.getBuild().getDirectory();
            if (parentOutputDirectory != null) {
                moduleStagingDirectory = parentOutputDirectory + "/staging";
            }
        }
    }

    if (moduleStagingDirectory == null) {
        throw new MojoExecutionException("Unable to determine module staging directory for project '"
                + project.getName() + "'"
                + (parentName != null ? " from project parent '" + parentName + "'" : " with no project parent")
                + ". Please use 'moduleStagingDirectory' configuration parameter to specify this.");
    }

    log.info("Using module staging directory: " + moduleStagingDirectory);

    return moduleStagingDirectory;
}

From source file:org.itcollege.valge.licenseaudit.model.Project.java

public Project(MavenProject project, List<Scope> scopes) {
    this.name = project.getName();
    this.artifactId = project.getArtifactId();
    this.groupId = project.getGroupId();
    this.version = project.getVersion();
    this.scopes = scopes;
}

From source file:org.jasig.maven.notice.AbstractNoticeMojo.java

License:Apache License

/**
 * Loads the dependency tree for the project via {@link #loadDependencyTree(MavenProject)} and then uses
 * the {@link DependencyNodeVisitor} to load the license data. If {@link #aggregating} is enabled the method
 * recurses on each child module./*  www. jav a 2s .  com*/
 */
@SuppressWarnings("unchecked")
protected void parseProject(MavenProject project, DependencyNodeVisitor visitor)
        throws MojoExecutionException, MojoFailureException {
    final Log logger = this.getLog();
    logger.info("Parsing Dependencies for: " + project.getName());

    //Load and parse immediate dependencies
    final DependencyNode tree = this.loadDependencyTree(project);
    tree.accept(visitor);

    //If not including child deps don't recurse on modules
    if (!this.includeChildDependencies) {
        return;
    }

    //No child modules, return
    final List<MavenProject> collectedProjects = project.getCollectedProjects();
    if (collectedProjects == null) {
        return;
    }

    //Find all sub-modules for the project
    for (final MavenProject moduleProject : collectedProjects) {
        if (this.isExcluded(moduleProject, project.getArtifactId())) {
            continue;
        }

        this.parseProject(moduleProject, visitor);
    }
}