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 2009/05/17 18:31:47 UTC
svn commit: r775699 - in
/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit:
AbstractRepoMojo.java DeployMojo.java InstallMojo.java
Author: bentmann
Date: Sun May 17 16:31:47 2009
New Revision: 775699
URL: http://svn.apache.org/viewvc?rev=775699&view=rev
Log:
o Extended IT plugin to support installation/deployment of POM projects
Added:
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AbstractRepoMojo.java (with props)
Modified:
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
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/AbstractRepoMojo.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/AbstractRepoMojo.java?rev=775699&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/AbstractRepoMojo.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/AbstractRepoMojo.java Sun May 17 16:31:47 2009
@@ -0,0 +1,89 @@
+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.repository.ArtifactRepository;
+import org.apache.maven.plugin.AbstractMojo;
+
+import java.io.File;
+import java.util.Collection;
+
+/**
+ * Provides common code for the install and deploy mojos.
+ *
+ * @author Benjamin Bentmann
+ * @version $Id$
+ */
+public abstract class AbstractRepoMojo
+ extends AbstractMojo
+{
+
+ /**
+ * The project's main artifact.
+ *
+ * @parameter default-value="${project.artifact}"
+ * @readonly
+ * @required
+ */
+ protected Artifact mainArtifact;
+
+ /**
+ * The project's attached artifact.
+ *
+ * @parameter default-value="${project.attachedArtifacts}"
+ * @readonly
+ * @required
+ */
+ protected Collection attachedArtifacts;
+
+ /**
+ * The packaging of the project.
+ *
+ * @parameter default-value="${project.packaging}"
+ * @required
+ * @readonly
+ */
+ protected String packaging;
+
+ /**
+ * The POM file of the project.
+ *
+ * @parameter default-value="${project.file}"
+ * @required
+ * @readonly
+ */
+ protected File pomFile;
+
+ /**
+ * The local repository.
+ *
+ * @parameter default-value="${localRepository}"
+ * @readonly
+ * @required
+ */
+ protected ArtifactRepository localRepository;
+
+ protected boolean isPomArtifact()
+ {
+ return "pom".equals( packaging );
+ }
+
+}
Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/AbstractRepoMojo.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/AbstractRepoMojo.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: 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=775699&r1=775698&r2=775699&view=diff
==============================================================================
--- 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 (original)
+++ 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 Sun May 17 16:31:47 2009
@@ -22,17 +22,13 @@
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
@@ -41,37 +37,10 @@
* @version $Id$
*/
public class DeployMojo
- extends AbstractMojo
+ extends AbstractRepoMojo
{
/**
- * 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}"
@@ -99,7 +68,14 @@
try
{
- deployer.deploy( mainArtifact.getFile(), mainArtifact, deploymentRepository, localRepository );
+ if ( isPomArtifact() )
+ {
+ deployer.deploy( pomFile, mainArtifact, deploymentRepository, localRepository );
+ }
+ else
+ {
+ deployer.deploy( mainArtifact.getFile(), mainArtifact, deploymentRepository, localRepository );
+ }
if ( attachedArtifacts != null )
{
Modified: 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=775699&r1=775698&r2=775699&view=diff
==============================================================================
--- 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 (original)
+++ 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 Sun May 17 16:31:47 2009
@@ -21,18 +21,13 @@
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
@@ -41,37 +36,10 @@
* @version $Id$
*/
public class InstallMojo
- extends AbstractMojo
+ extends AbstractRepoMojo
{
/**
- * 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
@@ -90,7 +58,14 @@
try
{
- installer.install( mainArtifact.getFile(), mainArtifact, localRepository );
+ if ( isPomArtifact() )
+ {
+ installer.install( pomFile, mainArtifact, localRepository );
+ }
+ else
+ {
+ installer.install( mainArtifact.getFile(), mainArtifact, localRepository );
+ }
if ( attachedArtifacts != null )
{