You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/10/07 13:57:14 UTC

svn commit: r702445 - in /maven/core-integration-testing/trunk/core-it-support/core-it-plugins: ./ maven-it-plugin-artifact/ maven-it-plugin-artifact/src/ maven-it-plugin-artifact/src/main/ maven-it-plugin-artifact/src/main/java/ maven-it-plugin-artifa...

Author: bentmann
Date: Tue Oct  7 04:57:13 2008
New Revision: 702445

URL: http://svn.apache.org/viewvc?rev=702445&view=rev
Log:
o Added new IT plugin to play with build artifacts

Added:
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/   (with props)
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/pom.xml   (with props)
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachMojo.java   (with props)
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachPomMojo.java   (with props)
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java   (with props)
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java   (with props)
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/SetMojo.java   (with props)
Modified:
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml

Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct  7 04:57:13 2008
@@ -0,0 +1,7 @@
+target
+*.iml
+.classpath
+.project
+.settings
+target-eclipse
+bin

Added: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/pom.xml?rev=702445&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/pom.xml Tue Oct  7 04:57:13 2008
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>maven-it-plugins</artifactId>
+    <groupId>org.apache.maven.its.plugins</groupId>
+    <version>2.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-it-plugin-artifact</artifactId>
+  <packaging>maven-plugin</packaging>
+
+  <name>Maven Integration Test Plugin :: Artifact</name>
+  <description>
+    A test plugin that manages the build artifacts of a project. More precisely, it can set the main artifact's file,
+    attach artifacts and install/deploy them to the repos. As such, it is the simplified essence of a bunch of
+    production plugins.
+  </description>
+  <inceptionYear>2008</inceptionYear>
+
+  <properties>
+    <maven.test.skip>true</maven.test.skip>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>2.0</version>
+    </dependency>
+  </dependencies>
+</project>

Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachMojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachMojo.java?rev=702445&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachMojo.java (added)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachMojo.java Tue Oct  7 04:57:13 2008
@@ -0,0 +1,107 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+
+import java.io.File;
+
+/**
+ * Attaches a secondary artifact to the current project. This mimics source/javadoc attachments or other assemblies.
+ * 
+ * @goal attach
+ * @phase package
+ * 
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class AttachMojo
+    extends AbstractMojo
+{
+
+    /**
+     * The current Maven project.
+     * 
+     * @parameter default-value="${project}"
+     * @readonly
+     * @required
+     */
+    private MavenProject project;
+
+    /**
+     * The Maven project helper.
+     * 
+     * @component
+     */
+    private MavenProjectHelper helper;
+
+    /**
+     * The path to the file to attach, relative to the project base directory. The plugin will not validate this path.
+     * 
+     * @parameter expression="${artifact.attachedFile}"
+     * @required
+     */
+    private String attachedFile;
+
+    /**
+     * @parameter expression="${artifact.artifactType}" default-value="jar"
+     */
+    private String artifactType = "jar";
+
+    /**
+     * @parameter expression="${artifact.artifactClassifier}" default-value="it"
+     */
+    private String artifactClassifier = "it";
+
+    /**
+     * Runs this mojo.
+     * 
+     * @throws MojoFailureException If the attached file has not been set.
+     */
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        getLog().info( "[MAVEN-CORE-IT-LOG] Attaching artifact file: " + attachedFile );
+        getLog().info( "[MAVEN-CORE-IT-LOG] type=" + artifactType + ", classifier=" + artifactClassifier );
+
+        if ( attachedFile == null || attachedFile.length() <= 0 )
+        {
+            throw new MojoFailureException( "Path name for attached artifact file has not been specified" );
+        }
+
+        /*
+         * NOTE: We do not want to test path translation here, so resolve relative paths manually.
+         */
+        File artifactFile = new File( attachedFile );
+        if ( !artifactFile.isAbsolute() )
+        {
+            artifactFile = new File( project.getBasedir(), attachedFile );
+        }
+
+        helper.attachArtifact( project, artifactType, artifactClassifier, artifactFile );
+
+        getLog().info( "[MAVEN-CORE-IT-LOG] Attached artifact file: " + artifactFile );
+    }
+
+}

Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachPomMojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachPomMojo.java?rev=702445&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachPomMojo.java (added)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachPomMojo.java Tue Oct  7 04:57:13 2008
@@ -0,0 +1,92 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.artifact.ProjectArtifactMetadata;
+
+import java.io.File;
+
+/**
+ * Attaches a POM to the main artifact.
+ * 
+ * @goal attach-pom
+ * @phase package
+ * 
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class AttachPomMojo
+    extends AbstractMojo
+{
+
+    /**
+     * The current Maven project.
+     * 
+     * @parameter default-value="${project}"
+     * @readonly
+     * @required
+     */
+    private MavenProject project;
+
+    /**
+     * The path to the POM file to attach to the main artifact, relative to the project base directory. The plugin will
+     * not validate this path.
+     * 
+     * @parameter expression="${artifact.pomFile}" default-value="${project.file.path}"
+     * @required
+     */
+    private String pomFile;
+
+    /**
+     * Runs this mojo.
+     * 
+     * @throws MojoFailureException If the artifact file has not been set.
+     */
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        getLog().info( "[MAVEN-CORE-IT-LOG] Attaching POM to main artifact: " + pomFile );
+
+        if ( pomFile == null || pomFile.length() <= 0 )
+        {
+            throw new MojoFailureException( "Path name for POM file has not been specified" );
+        }
+
+        /*
+         * NOTE: We do not want to test path translation here, so resolve relative paths manually.
+         */
+        File metadataFile = new File( pomFile );
+        if ( !metadataFile.isAbsolute() )
+        {
+            metadataFile = new File( project.getBasedir(), pomFile );
+        }
+
+        Artifact artifact = project.getArtifact();
+        artifact.addMetadata( new ProjectArtifactMetadata( artifact, metadataFile ) );
+
+        getLog().info( "[MAVEN-CORE-IT-LOG] Attached POM to main artifact: " + metadataFile );
+    }
+
+}

Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachPomMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AttachPomMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java?rev=702445&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java (added)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java Tue Oct  7 04:57:13 2008
@@ -0,0 +1,120 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.deployer.ArtifactDeployer;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * Deploys the project artifacts to the distribution repository. This is the essence of the Maven Deploy Plugin.
+ * <strong>Note:</strong> Unlike the production plugin, this plugin does not handle projects with "pom" packaging for
+ * the sake of simplicity.
+ * 
+ * @goal deploy
+ * @phase deploy
+ * 
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class DeployMojo
+    extends AbstractMojo
+{
+
+    /**
+     * The project's main artifact.
+     * 
+     * @parameter default-value="${project.artifact}"
+     * @readonly
+     * @required
+     */
+    private Artifact mainArtifact;
+
+    /**
+     * The project's attached artifact.
+     * 
+     * @parameter default-value="${project.attachedArtifacts}"
+     * @readonly
+     * @required
+     */
+    private Collection attachedArtifacts;
+
+    /**
+     * The local repository.
+     * 
+     * @parameter default-value="${localRepository}"
+     * @readonly
+     * @required
+     */
+    private ArtifactRepository localRepository;
+
+    /**
+     * The distribution repository.
+     * 
+     * @parameter expression="${project.distributionManagementArtifactRepository}"
+     * @readonly
+     * @required
+     */
+    private ArtifactRepository deploymentRepository;
+
+    /**
+     * The artifact deployer.
+     * 
+     * @component
+     */
+    private ArtifactDeployer deployer;
+
+    /**
+     * Runs this mojo.
+     * 
+     * @throws MojoExecutionException If any artifact could not be installed.
+     */
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        getLog().info( "[MAVEN-CORE-IT-LOG] Deploying project artifacts" );
+
+        try
+        {
+            deployer.deploy( mainArtifact.getFile(), mainArtifact, deploymentRepository, localRepository );
+
+            if ( attachedArtifacts != null )
+            {
+                for ( Iterator it = attachedArtifacts.iterator(); it.hasNext(); )
+                {
+                    Artifact attachedArtifact = (Artifact) it.next();
+                    deployer.deploy( attachedArtifact.getFile(), attachedArtifact, deploymentRepository,
+                                     localRepository );
+                }
+            }
+        }
+        catch ( Exception e )
+        {
+            throw new MojoExecutionException( "Failed to deploy artifacts", e );
+        }
+    }
+
+}

Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java?rev=702445&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java (added)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java Tue Oct  7 04:57:13 2008
@@ -0,0 +1,110 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.installer.ArtifactInstaller;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * Installs the project artifacts into the local repository. This is the essence of the Maven Install Plugin.
+ * <strong>Note:</strong> Unlike the production plugin, this plugin does not handle projects with "pom" packaging for
+ * the sake of simplicity.
+ * 
+ * @goal install
+ * @phase install
+ * 
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class InstallMojo
+    extends AbstractMojo
+{
+
+    /**
+     * The project's main artifact.
+     * 
+     * @parameter default-value="${project.artifact}"
+     * @readonly
+     * @required
+     */
+    private Artifact mainArtifact;
+
+    /**
+     * The project's attached artifact.
+     * 
+     * @parameter default-value="${project.attachedArtifacts}"
+     * @readonly
+     * @required
+     */
+    private Collection attachedArtifacts;
+
+    /**
+     * The local repository.
+     * 
+     * @parameter default-value="${localRepository}"
+     * @readonly
+     * @required
+     */
+    private ArtifactRepository localRepository;
+
+    /**
+     * The artifact installer.
+     * 
+     * @component
+     */
+    private ArtifactInstaller installer;
+
+    /**
+     * Runs this mojo.
+     * 
+     * @throws MojoExecutionException If any artifact could not be installed.
+     */
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        getLog().info( "[MAVEN-CORE-IT-LOG] Installing project artifacts" );
+
+        try
+        {
+            installer.install( mainArtifact.getFile(), mainArtifact, localRepository );
+
+            if ( attachedArtifacts != null )
+            {
+                for ( Iterator it = attachedArtifacts.iterator(); it.hasNext(); )
+                {
+                    Artifact attachedArtifact = (Artifact) it.next();
+                    installer.install( attachedArtifact.getFile(), attachedArtifact, localRepository );
+                }
+            }
+        }
+        catch ( Exception e )
+        {
+            throw new MojoExecutionException( "Failed to install artifacts", e );
+        }
+    }
+
+}

Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/SetMojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/SetMojo.java?rev=702445&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/SetMojo.java (added)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/SetMojo.java Tue Oct  7 04:57:13 2008
@@ -0,0 +1,92 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+
+import java.io.File;
+
+/**
+ * Sets the main artifact's file. This is the essence of the Maven JAR Plugin and all the other packaging plugins.
+ * Creating the actual file for the main artifact is a specific plugin job and not related to the Maven core.
+ * 
+ * @goal set
+ * @phase package
+ * 
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public class SetMojo
+    extends AbstractMojo
+{
+
+    /**
+     * The current Maven project.
+     * 
+     * @parameter default-value="${project}"
+     * @readonly
+     * @required
+     */
+    private MavenProject project;
+
+    /**
+     * The path to the file to set as the main artifact, relative to the project base directory. The plugin will not
+     * validate this path.
+     * 
+     * @parameter expression="${artifact.mainFile}"
+     * @required
+     */
+    private String mainFile;
+
+    /**
+     * Runs this mojo.
+     * 
+     * @throws MojoFailureException If the artifact file has not been set.
+     */
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        getLog().info( "[MAVEN-CORE-IT-LOG] Setting main artifact file: " + mainFile );
+
+        if ( mainFile == null || mainFile.length() <= 0 )
+        {
+            throw new MojoFailureException( "Path name for main artifact file has not been specified" );
+        }
+
+        /*
+         * NOTE: We do not want to test path translation here, so resolve relative paths manually.
+         */
+        File artifactFile = new File( mainFile );
+        if ( !artifactFile.isAbsolute() )
+        {
+            artifactFile = new File( project.getBasedir(), mainFile );
+        }
+
+        Artifact artifact = project.getArtifact();
+        artifact.setFile( artifactFile );
+
+        getLog().info( "[MAVEN-CORE-IT-LOG] Set main artifact file: " + artifactFile );
+    }
+
+}

Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/SetMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/SetMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml?rev=702445&r1=702444&r2=702445&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml (original)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml Tue Oct  7 04:57:13 2008
@@ -35,6 +35,7 @@
   <name>Maven Integration Tests :: Plugins</name>
 
   <modules>
+    <module>maven-it-plugin-artifact</module>
     <module>maven-it-plugin-configuration</module>
     <module>maven-it-plugin-context-passing</module>
     <module>maven-it-plugin-core-stubs</module>