Example usage for org.apache.maven.artifact Artifact setArtifactId

List of usage examples for org.apache.maven.artifact Artifact setArtifactId

Introduction

In this page you can find the example usage for org.apache.maven.artifact Artifact setArtifactId.

Prototype

void setArtifactId(String artifactId);

Source Link

Usage

From source file:com.linkedin.oneclick.hadoop.LauncherPlugin.java

License:Apache License

static void convert(LauncherConfig.Artifact src, Artifact dest) {
    dest.setGroupId(src.getGroupId());//  w ww.  java  2  s  .co  m
    dest.setArtifactId(src.getArtifactId());
    dest.setVersion(src.getVersion());
    dest.setFile(src.getFile());
    dest.setScope(src.getScope());
}

From source file:org.apache.archiva.converter.artifact.LegacyToDefaultConverter.java

License:Apache License

private boolean doRelocation(Artifact artifact, org.apache.maven.model.v3_0_0.Model v3Model,
        ArtifactRepository repository, FileTransaction transaction) throws IOException {
    Properties properties = v3Model.getProperties();
    if (properties.containsKey("relocated.groupId") || properties.containsKey("relocated.artifactId")
    //$NON-NLS-1$ //$NON-NLS-2$
            || properties.containsKey("relocated.version")) //$NON-NLS-1$
    {/*from   w  ww . j  av  a  2  s . c o m*/
        String newGroupId = properties.getProperty("relocated.groupId", v3Model.getGroupId()); //$NON-NLS-1$
        properties.remove("relocated.groupId"); //$NON-NLS-1$

        String newArtifactId = properties.getProperty("relocated.artifactId", v3Model.getArtifactId()); //$NON-NLS-1$
        properties.remove("relocated.artifactId"); //$NON-NLS-1$

        String newVersion = properties.getProperty("relocated.version", v3Model.getVersion()); //$NON-NLS-1$
        properties.remove("relocated.version"); //$NON-NLS-1$

        String message = properties.getProperty("relocated.message", ""); //$NON-NLS-1$ //$NON-NLS-2$
        properties.remove("relocated.message"); //$NON-NLS-1$

        if (properties.isEmpty()) {
            v3Model.setProperties(null);
        }

        writeRelocationPom(v3Model.getGroupId(), v3Model.getArtifactId(), v3Model.getVersion(), newGroupId,
                newArtifactId, newVersion, message, repository, transaction);

        v3Model.setGroupId(newGroupId);
        v3Model.setArtifactId(newArtifactId);
        v3Model.setVersion(newVersion);

        artifact.setGroupId(newGroupId);
        artifact.setArtifactId(newArtifactId);
        artifact.setVersion(newVersion);

        return true;
    } else {
        return false;
    }
}

From source file:org.apache.aries.plugin.eba.stubs.EbaMavenProjectStub.java

License:Apache License

public Artifact getArtifact() {
    Artifact artifact = new EbaArtifactStub();

    artifact.setGroupId(getGroupId());//from   w  w w.  java 2s.  com

    artifact.setArtifactId(getArtifactId());

    artifact.setVersion(getVersion());

    return artifact;
}

From source file:org.apache.aries.plugin.eba.stubs.EbaMavenProjectStub.java

License:Apache License

protected Artifact createArtifact(String groupId, String artifactId, String version, boolean optional) {
    Artifact artifact = new EbaArtifactStub();

    artifact.setGroupId(groupId);//ww w . j  a  v a2s. c o m

    artifact.setArtifactId(artifactId);

    artifact.setVersion(version);

    artifact.setOptional(optional);

    artifact.setFile(new File(getBasedir() + "/src/test/remote-repo/" + artifact.getGroupId().replace('.', '/')
            + "/" + artifact.getArtifactId() + "/" + artifact.getVersion() + "/" + artifact.getArtifactId()
            + "-" + artifact.getVersion() + ".jar"));

    return artifact;
}

From source file:org.apache.aries.plugin.esa.stubs.EsaMavenProjectStub.java

License:Apache License

public Artifact getArtifact() {
    Artifact artifact = new EsaArtifactStub();

    artifact.setGroupId(getGroupId());//from w w w .  java 2 s  . co  m

    artifact.setArtifactId(getArtifactId());

    artifact.setVersion(getVersion());

    return artifact;
}

From source file:org.apache.aries.plugin.esa.stubs.EsaMavenProjectStub.java

License:Apache License

protected Artifact createArtifact(String groupId, String artifactId, String version, String type,
        boolean optional) {
    Artifact artifact = new EsaArtifactStub();

    artifact.setGroupId(groupId);//  ww w.j  a  va  2s .  c  o  m

    artifact.setArtifactId(artifactId);

    artifact.setVersion(version);

    artifact.setOptional(optional);

    artifact.setFile(new File(getBasedir() + "/src/test/remote-repo/" + artifact.getGroupId().replace('.', '/')
            + "/" + artifact.getArtifactId() + "/" + artifact.getVersion() + "/" + artifact.getArtifactId()
            + "-" + artifact.getVersion() + "." + type));

    return artifact;
}

From source file:org.codehaus.mojo.cobertura.AbstractCoberturaTestCase.java

License:Apache License

private Artifact createArtifact(String groupId, String artifactId, String version, String type,
        String localRepository) {
    Artifact artifact;
    artifact = new ArtifactStub();
    artifact.setGroupId(groupId);//from   w  w w.  ja v  a2 s.  com
    artifact.setArtifactId(artifactId);
    artifact.setVersion(version);
    artifact.setFile(new File(localRepository + "/" + groupId.replace(".", "/") + "/" + artifactId + "/"
            + version + "/" + artifactId + "-" + version + "." + type));
    assertArtifactExists(artifact);
    return artifact;
}

From source file:org.izpack.mojo.IzPackNewMojo.java

License:Open Source License

public void execute() throws MojoExecutionException, MojoFailureException {
    File jarFile = getJarFile();//from   ww  w  . ja v  a2 s.  c  om

    CompilerData compilerData = initCompilerData(jarFile);
    CompilerContainer compilerContainer = new CompilerContainer();
    compilerContainer.addConfig("installFile", installFile.getPath());
    compilerContainer.getComponent(IzpackProjectInstaller.class);
    compilerContainer.addComponent(CompilerData.class, compilerData);
    compilerContainer.addComponent(Handler.class, createLogHandler());

    CompilerConfig compilerConfig = compilerContainer.getComponent(CompilerConfig.class);

    propertyManager = compilerContainer.getComponent(PropertyManager.class);
    initMavenProperties(propertyManager);

    try {
        compilerConfig.executeCompiler();
    } catch (CompilerException e) {
        //TODO: This might be enhanced with other exceptions which
        // should be handled like CompilerException
        throw new MojoFailureException("Failure during compilation process", e);
    } catch (Exception e) {
        throw new MojoExecutionException("Failure", e);
    }

    if (classifier != null && !classifier.isEmpty()) {
        if (enableAttachArtifact) {
            projectHelper.attachArtifact(project, "jar", classifier, jarFile);
        }
    } else {
        if (enableOverrideArtifact) {
            Artifact artifact = project.getArtifact();
            artifact.setArtifactId(finalName);
            artifact.setFile(jarFile);
        }
    }
}

From source file:org.jfrog.jade.plugins.idea.stubs.SimpleMavenProjectStub.java

License:Apache License

public Artifact getArtifact() {
    Artifact artifact = new IdeaArtifactStub();

    artifact.setGroupId(getGroupId());/*from w  w w  .  j a  va2  s.  com*/

    artifact.setArtifactId(getArtifactId());

    artifact.setVersion(getVersion());

    return artifact;
}

From source file:org.jfrog.jade.plugins.idea.stubs.SimpleMavenProjectStub.java

License:Apache License

protected Artifact createArtifact(String groupId, String artifactId, String version) {
    Artifact artifact = new IdeaArtifactStub();

    artifact.setGroupId(groupId);//www .  j  a  v a 2s .c o m
    artifact.setArtifactId(artifactId);
    artifact.setVersion(version);
    artifact.setFile(new File(PlexusTestCase.getBasedir(),
            "target/local-repo/" + artifact.getGroupId().replace('.', '/') + "/" + artifact.getArtifactId()
                    + "/" + artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + artifact.getVersion()
                    + ".jar"));

    return artifact;
}