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

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

Introduction

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

Prototype

public String getArtifactId() 

Source Link

Usage

From source file:net.oneandone.maven.plugins.prerelease.core.Descriptor.java

License:Apache License

public static String tagurl(String svnurl, MavenProject project) throws CannotDeterminTagBase {
    int idx;//from w  w w . ja  v  a 2s . c om

    svnurl = svnurl + "/";
    idx = svnurl.indexOf("/trunk/");
    if (idx == -1) {
        idx = svnurl.indexOf("/branches/");
        if (idx == -1) {
            throw new CannotDeterminTagBase(svnurl);
        }
    }
    return svnurl.substring(0, idx) + "/tags" + "/" + project.getArtifactId() + "-" + releaseVersion(project);
}

From source file:net.oneandone.maven.plugins.prerelease.core.Project.java

License:Apache License

public static Project forMavenProject(MavenProject project, String version) {
    return new Project(project.getGroupId(), project.getArtifactId(), version);
}

From source file:net.oneandone.maven.plugins.prerelease.util.PromoteExecutionListener.java

License:Apache License

@Override
public void projectStarted(ExecutionEvent event) {
    MavenProject project;
    Artifact projectArtifact;/*from w ww.  j ava 2s .  c  o m*/
    Versioning versioning;
    ArtifactRepositoryMetadata metadata;
    GroupRepositoryMetadata groupMetadata;

    project = event.getSession().getCurrentProject();
    try {
        prerelease.artifactFiles(project, projectHelper);
        project.getProperties().putAll(prerelease.descriptor.deployProperties);
        if (prerelease.descriptor.deployPluginMetadata) {
            // from http://svn.apache.org/viewvc/maven/plugin-tools/tags/maven-plugin-tools-3.2/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java

            projectArtifact = project.getArtifact();
            versioning = new Versioning();
            versioning.setLatest(projectArtifact.getVersion());
            versioning.updateTimestamp();
            metadata = new ArtifactRepositoryMetadata(projectArtifact, versioning);
            projectArtifact.addMetadata(metadata);
            groupMetadata = new GroupRepositoryMetadata(project.getGroupId());
            groupMetadata.addPluginMapping(
                    PluginDescriptor.getGoalPrefixFromArtifactId(project.getArtifactId()),
                    project.getArtifactId(), project.getName());

            projectArtifact.addMetadata(groupMetadata);
        }
    } catch (IOException e) {
        throw new RuntimeException("TODO", e);
    }
    super.projectStarted(event);
}

From source file:net.oneandone.maven.rules.common.RuleHelper.java

License:Apache License

public static String getProjectIdentifier(MavenProject mavenProject) {
    return mavenProject.getGroupId() + ":" + mavenProject.getArtifactId();
}

From source file:net.oneandone.pommes.cli.Environment.java

License:Apache License

public String lookup(String name) throws IOException {
    MavenProject p;
    FileNode here;//from   w  w w.  ja  v  a 2s  .  c o m
    Point point;

    switch (name) {
    case "svn":
        here = (FileNode) world.getWorking();
        point = fstab().pointOpt(here);
        if (point == null) {
            throw new IllegalArgumentException("no mount point for directory " + here.getAbsolute());
        }
        return point.svnurl(here);
    case "gav":
        p = project();
        return p.getGroupId() + ":" + p.getArtifactId() + ":" + p.getVersion();
    case "ga":
        p = project();
        return p.getGroupId() + ":" + p.getArtifactId();
    default:
        return null;
    }
}

From source file:net.oneandone.pommes.model.Pom.java

License:Apache License

public static Pom forProject(String origin, MavenProject project) {
    Pom result;/*from  ww w .j  a  v  a 2  s .  co m*/

    result = new Pom(origin, new GAV(project.getGroupId(), project.getArtifactId(), project.getVersion()));
    for (Dependency dependency : project.getDependencies()) {
        result.dependencies.add(GAV.forDependency(dependency));
    }
    return result;
}

From source file:net.oneandone.stool.stage.SourceStage.java

License:Apache License

@Override
public List<String> vhostNames() throws IOException {
    List<String> names;

    names = new ArrayList<>();
    for (MavenProject project : wars()) {
        names.add(project.getArtifactId());
    }//  ww  w.  ja v a 2  s.c  om
    return names;
}

From source file:net.oneandone.stool.stage.SourceStage.java

License:Apache License

@Override
public Map<String, FileNode> vhosts() throws IOException {
    Map<String, FileNode> applications;

    applications = new LinkedHashMap<>();
    for (MavenProject project : wars()) {
        applications.put(project.getArtifactId(), docroot(session.world, project));
    }// ww  w.  j  ava2s  .c om
    return applications;
}

From source file:net.oneki.maven.plugins.helper.ArtifactHelper.java

License:Apache License

public static String getArtifactCoord(MavenProject project) {
    return getArtifactCoord(project.getGroupId(), project.getArtifactId(), project.getVersion());
}

From source file:net.roboconf.maven.ValidateApplicationMojo.java

License:Apache License

/**
 * Validate aspects that are specific to recipes (i.e. partial Roboconf applications).
 * <p>/* w  ww  .  j a v  a  2 s  .  co m*/
 * Most of this validation could have been handled through enforcer rules. However,
 * they are all warnings and we do not want to create hundreds of projects. We can
 * see these rules as good practices that will be shared amongst all the Roboonf users.
 * </p>
 * <p>
 * At worst, users can ignore these warnings.
 * Or they can submit a feature request to add or remove validation rules.
 * </p>
 *
 * @param project a Maven project
 * @param tpl an application template
 * @param official true if this recipe is maintained by the Roboconf team, false otherwise
 * @return a non-null list of errors
 */
static Collection<RoboconfError> validateRecipesSpecifics(MavenProject project, ApplicationTemplate tpl,
        boolean official) {

    Collection<RoboconfError> result = new ArrayList<>();
    if (!project.getArtifactId().equals(project.getArtifactId().toLowerCase()))
        result.add(new RoboconfError(ErrorCode.REC_ARTIFACT_ID_IN_LOWER_CASE));

    if (!tpl.getRootInstances().isEmpty())
        result.add(new RoboconfError(ErrorCode.REC_AVOID_INSTANCES));

    if (official && !Constants.OFFICIAL_RECIPES_GROUP_ID.equals(project.getGroupId()))
        result.add(new RoboconfError(ErrorCode.REC_OFFICIAL_GROUP_ID));

    if (!project.getArtifactId().equals(project.getArtifactId()))
        result.add(new RoboconfError(ErrorCode.REC_NON_MATCHING_ARTIFACT_ID));

    File[] files = project.getBasedir().listFiles();
    boolean found = false;
    if (files != null) {
        for (int i = 0; i < files.length && !found; i++)
            found = files[i].getName().matches("(?i)readme(\\..*)?");
    }

    if (!found)
        result.add(new RoboconfError(ErrorCode.REC_MISSING_README));

    return result;
}