Example usage for org.apache.maven.artifact.repository.metadata ArtifactRepositoryMetadata ArtifactRepositoryMetadata

List of usage examples for org.apache.maven.artifact.repository.metadata ArtifactRepositoryMetadata ArtifactRepositoryMetadata

Introduction

In this page you can find the example usage for org.apache.maven.artifact.repository.metadata ArtifactRepositoryMetadata ArtifactRepositoryMetadata.

Prototype

public ArtifactRepositoryMetadata(Artifact artifact, Versioning versioning) 

Source Link

Usage

From source file:io.takari.maven.plugins.plugin.AddPluginArtifactMetadataMojo.java

License:Apache License

@Override
protected void executeMojo() throws MojoExecutionException {
    Artifact projectArtifact = project.getArtifact();

    Versioning versioning = new Versioning();
    versioning.setLatest(projectArtifact.getVersion());
    versioning.updateTimestamp();// ww w.j  a  va2  s.c  o  m
    ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata(projectArtifact, versioning);
    projectArtifact.addMetadata(metadata);

    GroupRepositoryMetadata groupMetadata = new GroupRepositoryMetadata(project.getGroupId());
    groupMetadata.addPluginMapping(getGoalPrefix(), project.getArtifactId(), project.getName());

    projectArtifact.addMetadata(groupMetadata);
}

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

License:Apache License

@Override
public void projectStarted(ExecutionEvent event) {
    MavenProject project;//from w  w  w . j  a  v  a2  s.  co  m
    Artifact projectArtifact;
    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);
}