Hello,

I try to get the artifact name in a home-made plugin. I use the code below 
based on the maven-install-plugin.
I am expecting the plugin name to be set after the package phase but it is not 
the case.
I probably did not get a concept, could you let me know if something obvious is 
missing ?

Regards,



import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;

/**
 * Goal to get the artifact filename
 * 
 * @goal filename
 * @execute phase="package"
 */
public class ArtifactNameTest extends AbstractMojo

{
        /**
         * @parameter expression="${project.artifact}"
         * @required
         * @readonly
         */
        private Artifact artifact;

        public void execute() throws MojoExecutionException {
                File file = artifact.getFile();
                if (file == null) {
                        getLog().error("artifact.getFile() == null");
                } else {
                        getLog().info("artifact.getFile() == " + 
file.getAbsolutePath());
                }
        }
}

Maven version: 2.1.0-M1

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to