You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2017/08/21 18:34:21 UTC

svn commit: r1805658 - in /maven/shared/branches/maven-artifact-transfer-MSHARED-656: ./ src/it/maven-artifact-deployer-plugin/ src/it/maven-artifact-deployer-plugin/src/ src/it/maven-artifact-deployer-plugin/src/main/ src/it/maven-artifact-deployer-pl...

Author: khmarbaise
Date: Mon Aug 21 18:34:20 2017
New Revision: 1805658

URL: http://svn.apache.org/viewvc?rev=1805658&view=rev
Log:
[MSHARED-656] Make integration testing for different Maven versions possible
 o Added integration testing for ArtifactDeployer done.

Added:
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/   (with props)
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/pom.xml
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/main/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/main/java/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/main/java/org/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/main/java/org/apache/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/main/java/org/apache/maven/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/main/java/org/apache/maven/plugin/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/main/java/org/apache/maven/plugin/artifact/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/main/java/org/apache/maven/plugin/artifact/deployer/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/main/java/org/apache/maven/plugin/artifact/deployer/ArtifactDeployerMojo.java
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/java/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/java/org/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/java/org/apache/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/java/org/apache/maven/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/java/org/apache/maven/plugin/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/java/org/apache/maven/plugin/artifact/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/java/org/apache/maven/plugin/artifact/deployer/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/java/org/apache/maven/plugin/artifact/deployer/ArtifactDeployerTest.java
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/java/org/apache/maven/plugin/artifact/deployer/component/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/projects/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/projects/example/
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/projects/example/pom.xml
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/site/apt/deploy-project.apt
Modified:
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/pom.xml
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-installer-plugin/src/main/java/org/apache/maven/plugin/artifact/installer/ArtifactInstallerMojo.java
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-installer-plugin/src/test/java/org/apache/maven/plugin/artifact/installer/ArtifactInstallerTest.java
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/main/java/org/apache/maven/shared/project/deploy/internal/DefaultProjectDeployer.java
    maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/site/apt/install-project.apt

Modified: maven/shared/branches/maven-artifact-transfer-MSHARED-656/pom.xml
URL: http://svn.apache.org/viewvc/maven/shared/branches/maven-artifact-transfer-MSHARED-656/pom.xml?rev=1805658&r1=1805657&r2=1805658&view=diff
==============================================================================
--- maven/shared/branches/maven-artifact-transfer-MSHARED-656/pom.xml (original)
+++ maven/shared/branches/maven-artifact-transfer-MSHARED-656/pom.xml Mon Aug 21 18:34:20 2017
@@ -303,6 +303,14 @@
                 <repository.proxy.url>${repository.proxy.url}</repository.proxy.url>
                 <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
               </filterProperties>
+              <extraArtifacts>
+                <extraArtifact>org.apache.maven:apache-maven:3.0.5:tar.gz:bin</extraArtifact>
+                <extraArtifact>org.apache.maven:apache-maven:3.1.1:tar.gz:bin</extraArtifact>
+                <extraArtifact>org.apache.maven:apache-maven:3.2.5:tar.gz:bin</extraArtifact>
+                <extraArtifact>org.apache.maven:apache-maven:3.3.1:tar.gz:bin</extraArtifact>
+                <extraArtifact>org.apache.maven:apache-maven:3.3.9:tar.gz:bin</extraArtifact>
+                <extraArtifact>org.apache.maven:apache-maven:3.5.0:tar.gz:bin</extraArtifact>
+              </extraArtifacts>
             </configuration>
             <executions>
               <execution>

Propchange: maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Aug 21 18:34:20 2017
@@ -0,0 +1,4 @@
+target
+.classpath
+.project
+.settings

Added: maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/pom.xml?rev=1805658&view=auto
==============================================================================
--- maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/pom.xml (added)
+++ maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/pom.xml Mon Aug 21 18:34:20 2017
@@ -0,0 +1,129 @@
+<?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/xsd/maven-4.0.0.xsd"
+>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-plugins</artifactId>
+    <version>30</version>
+    <relativePath />
+  </parent>
+
+  <artifactId>maven-artifact-deployer-plugin</artifactId>
+  <version>1.0.0</version>
+  <packaging>maven-plugin</packaging>
+
+  <name>Apache Maven Artifact Deployer Plugin</name>
+  <description>The plugin is only intended as a real testing environment for maven-artifact-deployer component.</description>
+  <prerequisites>
+    <maven>${mavenVersion}</maven>
+  </prerequisites>
+
+  <properties>
+    <mavenVersion>3.0</mavenVersion>
+    <javaVersion>8</javaVersion>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>${mavenVersion}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>${mavenVersion}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-artifact-transfer</artifactId>
+      <version>@project.version@</version>
+<!--       <version>0.10.0-SNAPSHOT</version> -->
+    </dependency>
+
+    <!-- dependencies to annotations -->
+    <dependency>
+      <groupId>org.apache.maven.plugin-tools</groupId>
+      <artifactId>maven-plugin-annotations</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>io.takari.maven.plugins</groupId>
+      <artifactId>takari-plugin-integration-testing</artifactId>
+      <version>2.9.1</version>
+      <type>pom</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>io.takari.maven.plugins</groupId>
+      <artifactId>takari-plugin-testing</artifactId>
+      <version>2.9.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.rat</groupId>
+          <artifactId>apache-rat-plugin</artifactId>
+          <configuration>
+            <skip>true</skip>
+          </configuration>
+        </plugin>
+        <plugin>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <configuration>
+            <systemProperties>
+              <maven.local.repo>${maven.local.repo}</maven.local.repo>
+              <localRepositoryPath>${localRepositoryPath}</localRepositoryPath>
+              <mvnVersion>${mvnVersion}</mvnVersion>
+            </systemProperties>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>io.takari.maven.plugins</groupId>
+        <artifactId>takari-lifecycle-plugin</artifactId>
+        <version>1.13.1</version>
+        <executions>
+          <execution>
+            <?m2e ignore ?>
+            <id>testProperties</id>
+            <phase>process-test-resources</phase>
+            <goals>
+              <goal>testProperties</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+
+  </build>
+</project>

Added: maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/main/java/org/apache/maven/plugin/artifact/deployer/ArtifactDeployerMojo.java
URL: http://svn.apache.org/viewvc/maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/main/java/org/apache/maven/plugin/artifact/deployer/ArtifactDeployerMojo.java?rev=1805658&view=auto
==============================================================================
--- maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/main/java/org/apache/maven/plugin/artifact/deployer/ArtifactDeployerMojo.java (added)
+++ maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/main/java/org/apache/maven/plugin/artifact/deployer/ArtifactDeployerMojo.java Mon Aug 21 18:34:20 2017
@@ -0,0 +1,131 @@
+package org.apache.maven.plugin.artifact.deployer;
+
+/*
+ * 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 java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.shared.artifact.deploy.ArtifactDeployer;
+import org.apache.maven.shared.artifact.deploy.ArtifactDeployerException;
+import org.apache.maven.shared.repository.RepositoryManager;
+
+/**
+ * This mojo is implemented to test the ArtifactDeployer part of the maven-artifact-transfer shared component.
+ */
+@Mojo( name = "artifact-deployer", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true )
+public class ArtifactDeployerMojo
+    extends AbstractMojo
+{
+
+    /**
+     * Parameter to have different locations for each Maven version we are testing with.
+     */
+    @Parameter
+    private String mvnVersion;
+
+    @Component
+    protected RepositoryManager repositoryManager;
+
+    @Parameter( defaultValue = "${session}", required = true, readonly = true )
+    protected MavenSession session;
+
+    @Component
+    private ArtifactDeployer deployer;
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        getLog().info( "Hello from artifact-deployer plugin" );
+        deployerProject( session.getProjectBuildingRequest() );
+        getLog().info( "Bye bye from artifact-deployer plugin" );
+    }
+
+    private void createFileContent( File outputFile )
+        throws IOException
+    {
+        Path file = outputFile.toPath();
+        List<String> asList = Arrays.asList( "Line 1", "Line 2" );
+        Files.write( file, asList, Charset.forName( "UTF-8" ) );
+    }
+
+    private void deployerProject( ProjectBuildingRequest pbr )
+        throws MojoFailureException, MojoExecutionException
+    {
+        try
+        {
+            DefaultArtifactHandler artifactHandler = new DefaultArtifactHandler();
+            artifactHandler.setExtension( "EXTENSION" );
+
+            File artifactsDirectory =
+                new File( session.getCurrentProject().getBuild().getDirectory(), "tests/artifacts" );
+            getLog().info( "Directory: '" + artifactsDirectory.getAbsolutePath() + "'" );
+            artifactsDirectory.mkdirs();
+
+            File tmpFile = File.createTempFile( "test-deploy", ".jar", artifactsDirectory );
+            createFileContent( tmpFile );
+
+            DefaultArtifact artifact = new DefaultArtifact( "DEPLOYER-GROUPID-" + mvnVersion, "ARTIFACTID", "VERSION",
+                                                            "compile", "jar", null, artifactHandler );
+            artifact.setFile( tmpFile );
+            artifact.setRepository( session.getProjectBuildingRequest().getLocalRepository() );
+
+            DefaultArtifact artifactWithClassifier =
+                new DefaultArtifact( "DEPLOYER-GROUPID-" + mvnVersion, "ARTIFACTID", "VERSION", "compile", "jar",
+                                     "CLASSIFIER", artifactHandler );
+            File tmpFileClassifier = File.createTempFile( "test-deploy-classifier", ".jar", artifactsDirectory );
+            createFileContent( tmpFileClassifier );
+            artifactWithClassifier.setFile( tmpFileClassifier );
+            artifactWithClassifier.setRepository( session.getProjectBuildingRequest().getLocalRepository() );
+
+            Collection<Artifact> mavenArtifacts = Arrays.<Artifact>asList( artifact, artifactWithClassifier );
+
+            deployer.deploy( session.getProjectBuildingRequest(), mavenArtifacts );
+        }
+        catch ( ArtifactDeployerException e )
+        {
+            throw new MojoExecutionException( "ArtifactDeployerException", e );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "IOException", e );
+        }
+    }
+
+}

Added: maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/java/org/apache/maven/plugin/artifact/deployer/ArtifactDeployerTest.java
URL: http://svn.apache.org/viewvc/maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/java/org/apache/maven/plugin/artifact/deployer/ArtifactDeployerTest.java?rev=1805658&view=auto
==============================================================================
--- maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/java/org/apache/maven/plugin/artifact/deployer/ArtifactDeployerTest.java (added)
+++ maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/java/org/apache/maven/plugin/artifact/deployer/ArtifactDeployerTest.java Mon Aug 21 18:34:20 2017
@@ -0,0 +1,89 @@
+package org.apache.maven.plugin.artifact.deployer;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import io.takari.maven.testing.TestResources;
+import io.takari.maven.testing.executor.MavenExecutionResult;
+import io.takari.maven.testing.executor.MavenRuntime;
+import io.takari.maven.testing.executor.MavenRuntime.MavenRuntimeBuilder;
+import io.takari.maven.testing.executor.MavenVersions;
+import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;
+
+/**
+ * This will check if the ArtifactInstaller works for all Maven versions 3.0.5, 3.1.1, 3.2.5, 3.3.1, 3.3.9, 3.5.0. This
+ * is done by using the test plugin <code>maven-artifact-deployer-plugin</code> which uses the ArtifactInstaller as component.
+ * By using this way we get a real runtime environment which supports all Maven versions.
+ * 
+ * @author Karl Heinz Marbaise
+ */
+@RunWith( MavenJUnitTestRunner.class )
+@MavenVersions( { "3.0.5", "3.1.1", "3.2.5", "3.3.1", "3.3.9", "3.5.0" } )
+public class ArtifactDeployerTest
+{
+
+    @Rule
+    public final TestResources resources = new TestResources();
+
+    public final MavenRuntime mavenRuntime;
+
+    public ArtifactDeployerTest( MavenRuntimeBuilder builder )
+        throws Exception
+    {
+        this.mavenRuntime = builder.build();
+    }
+
+    @Test
+    public void buildExample()
+        throws Exception
+    {
+        File basedir = resources.getBasedir( "example" );
+        //@formatter:off
+        MavenExecutionResult result =
+            mavenRuntime
+                .forProject( basedir )
+                .withCliOption( "-DmvnVersion=" + mavenRuntime.getMavenVersion() ) // Might be superfluous
+                .withCliOption( "-B" )
+                .withCliOption( "-V" )
+                .execute( "clean", "verify" );
+        //@formatter:on
+
+        result.assertErrorFreeLog();
+        // Check that the current plugins has been called at least once.
+        result.assertLogText( "[INFO] --- maven-artifact-deployer-plugin:1.0.0:artifact-deployer (id-artifact-deployer) @ maven-artifact-deployer-plugin-it ---" );
+
+        String mvnVersion = mavenRuntime.getMavenVersion();
+        // The "." will be replaced by "/" in the running of the artifact-installer-plugin so I need to do the same here.
+        // Maybe there is a more elegant way to do that?
+        mvnVersion = mvnVersion.replaceAll( "\\.", "/" );
+
+        String mavenRepoLocal = System.getProperty( "maven.repo.local" );
+        File localRepo = new File( mavenRepoLocal );
+
+        System.out.println( "localRepo='" + localRepo.getAbsolutePath() + "'" );
+        System.out.println( "mvnVersion='" + mvnVersion + "'" );
+
+        // The real checking of what should had happen..
+        
+        assertTrue( new File( localRepo,
+                              "DEPLOYER-GROUPID-" + mvnVersion + "/ARTIFACTID/VERSION/ARTIFACTID-VERSION.EXTENSION" ).exists() );
+        assertTrue( new File( localRepo,
+                              "DEPLOYER-GROUPID-" + mvnVersion + "/ARTIFACTID/VERSION/ARTIFACTID-VERSION.EXTENSION.md5" ).exists() );
+        assertTrue( new File( localRepo,
+                              "DEPLOYER-GROUPID-" + mvnVersion + "/ARTIFACTID/VERSION/ARTIFACTID-VERSION.EXTENSION.sha1" ).exists() );
+
+        assertTrue( new File( localRepo, "DEPLOYER-GROUPID-" + mvnVersion
+            + "/ARTIFACTID/VERSION/ARTIFACTID-VERSION-CLASSIFIER.EXTENSION" ).exists() );
+        assertTrue( new File( localRepo, "DEPLOYER-GROUPID-" + mvnVersion
+                              + "/ARTIFACTID/VERSION/ARTIFACTID-VERSION-CLASSIFIER.EXTENSION.md5" ).exists() );
+        assertTrue( new File( localRepo, "DEPLOYER-GROUPID-" + mvnVersion
+                              + "/ARTIFACTID/VERSION/ARTIFACTID-VERSION-CLASSIFIER.EXTENSION.sha1" ).exists() );
+        assertTrue( new File( localRepo, "DEPLOYER-GROUPID-" + mvnVersion + "/ARTIFACTID/maven-metadata-local.xml" ).exists() ); // ??
+
+    }
+}
\ No newline at end of file

Added: maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/projects/example/pom.xml
URL: http://svn.apache.org/viewvc/maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/projects/example/pom.xml?rev=1805658&view=auto
==============================================================================
--- maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/projects/example/pom.xml (added)
+++ maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-deployer-plugin/src/test/projects/example/pom.xml Mon Aug 21 18:34:20 2017
@@ -0,0 +1,50 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<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/xsd/maven-4.0.0.xsd"
+>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.shared</groupId>
+    <artifactId>maven-shared-components</artifactId>
+    <version>30</version>
+    <relativePath />
+  </parent>
+
+  <artifactId>maven-artifact-deployer-plugin-it</artifactId>
+  <version>1.0.0-A</version>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.rat</groupId>
+          <artifactId>apache-rat-plugin</artifactId>
+          <configuration>
+            <skip>true</skip>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-artifact-deployer-plugin</artifactId>
+        <version>${it-plugin.version}</version>
+        <configuration>
+          <localRepositoryPath>${localRepositoryPath}</localRepositoryPath>
+          <mvnVersion>${mvnVersion}</mvnVersion>
+        </configuration>
+        <executions>
+          <execution>
+            <id>id-artifact-deployer</id>
+            <goals>
+              <goal>artifact-deployer</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Modified: maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-installer-plugin/src/main/java/org/apache/maven/plugin/artifact/installer/ArtifactInstallerMojo.java
URL: http://svn.apache.org/viewvc/maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-installer-plugin/src/main/java/org/apache/maven/plugin/artifact/installer/ArtifactInstallerMojo.java?rev=1805658&r1=1805657&r2=1805658&view=diff
==============================================================================
--- maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-installer-plugin/src/main/java/org/apache/maven/plugin/artifact/installer/ArtifactInstallerMojo.java (original)
+++ maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-installer-plugin/src/main/java/org/apache/maven/plugin/artifact/installer/ArtifactInstallerMojo.java Mon Aug 21 18:34:20 2017
@@ -21,8 +21,12 @@ package org.apache.maven.plugin.artifact
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.List;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.DefaultArtifact;
@@ -41,6 +45,7 @@ import org.apache.maven.shared.artifact.
 import org.apache.maven.shared.repository.RepositoryManager;
 
 /**
+ * This mojo is implemented to test the ArtifactInstaller part of the maven-artifact-transfer shared component.
  */
 @Mojo( name = "artifact-installer", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true )
 public class ArtifactInstallerMojo
@@ -70,6 +75,14 @@ public class ArtifactInstallerMojo
         getLog().info( "Bye bye from artifact-installer plugin" );
     }
 
+    private void createFileContent( File outputFile )
+        throws IOException
+    {
+        Path file = outputFile.toPath();
+        List<String> asList = Arrays.asList( "Line 1", "Line 2" );
+        Files.write( file, asList, Charset.forName( "UTF-8" ) );
+    }
+
     private void installProject( ProjectBuildingRequest pbr )
         throws MojoFailureException, MojoExecutionException
     {
@@ -84,6 +97,7 @@ public class ArtifactInstallerMojo
             artifactsDirectory.mkdirs();
 
             File tmpFile = File.createTempFile( "test-install", ".jar", artifactsDirectory );
+            createFileContent( tmpFile );
 
             DefaultArtifact artifact = new DefaultArtifact( "GROUPID-" + mvnVersion, "ARTIFACTID", "VERSION", "compile",
                                                             "jar", null, artifactHandler );
@@ -91,7 +105,10 @@ public class ArtifactInstallerMojo
             DefaultArtifact artifactWithClassifier =
                 new DefaultArtifact( "GROUPID-" + mvnVersion, "ARTIFACTID", "VERSION", "compile", "jar", "CLASSIFIER",
                                      artifactHandler );
-            artifactWithClassifier.setFile( tmpFile );
+
+            File tmpFileClassifier = File.createTempFile( "test-install-classifier", ".jar", artifactsDirectory );
+            createFileContent( tmpFileClassifier );
+            artifactWithClassifier.setFile( tmpFileClassifier );
 
             Collection<Artifact> mavenArtifacts = Arrays.<Artifact>asList( artifact, artifactWithClassifier );
 

Modified: maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-installer-plugin/src/test/java/org/apache/maven/plugin/artifact/installer/ArtifactInstallerTest.java
URL: http://svn.apache.org/viewvc/maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-installer-plugin/src/test/java/org/apache/maven/plugin/artifact/installer/ArtifactInstallerTest.java?rev=1805658&r1=1805657&r2=1805658&view=diff
==============================================================================
--- maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-installer-plugin/src/test/java/org/apache/maven/plugin/artifact/installer/ArtifactInstallerTest.java (original)
+++ maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/it/maven-artifact-installer-plugin/src/test/java/org/apache/maven/plugin/artifact/installer/ArtifactInstallerTest.java Mon Aug 21 18:34:20 2017
@@ -1,5 +1,6 @@
 package org.apache.maven.plugin.artifact.installer;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
@@ -17,7 +18,7 @@ import io.takari.maven.testing.executor.
 
 /**
  * This will check if the ArtifactInstaller works for all Maven versions 3.0.5, 3.1.1, 3.2.5, 3.3.1, 3.3.9, 3.5.0. This
- * is done by using the test plugin <code>maven-component-plugin</code> which uses the ArtifactInstaller as component.
+ * is done by using the test plugin <code>maven-artifact-installer-plugin</code> which uses the ArtifactInstaller as component.
  * By using this way we get a real runtime environment which supports all Maven versions.
  * 
  * @author Karl Heinz Marbaise
@@ -58,7 +59,8 @@ public class ArtifactInstallerTest
         result.assertLogText( "[INFO] --- maven-artifact-installer-plugin:1.0.0:artifact-installer (id-artifact-installer) @ maven-artifact-installer-plugin-it ---" );
 
         String mvnVersion = mavenRuntime.getMavenVersion();
-        // The "." will be replaced by "/" in the running of the artifact-installer-plugin so I need to do the same here.
+        // The "." will be replaced by "/" in the running of the artifact-installer-plugin so I need to do the same
+        // here.
         // Maybe there is a more elegant way to do that?
         mvnVersion = mvnVersion.replaceAll( "\\.", "/" );
 
@@ -71,8 +73,17 @@ public class ArtifactInstallerTest
         // The real checking of what should had happen..
         assertTrue( new File( localRepo,
                               "GROUPID-" + mvnVersion + "/ARTIFACTID/VERSION/ARTIFACTID-VERSION.EXTENSION" ).exists() );
+        assertFalse( new File( localRepo, "GROUPID-" + mvnVersion
+            + "/ARTIFACTID/VERSION/ARTIFACTID-VERSION.EXTENSION.md5" ).exists() );
+        assertFalse( new File( localRepo, "GROUPID-" + mvnVersion
+            + "/ARTIFACTID/VERSION/ARTIFACTID-VERSION.EXTENSION.sha1" ).exists() );
+
         assertTrue( new File( localRepo, "GROUPID-" + mvnVersion
             + "/ARTIFACTID/VERSION/ARTIFACTID-VERSION-CLASSIFIER.EXTENSION" ).exists() );
+        assertFalse( new File( localRepo, "GROUPID-" + mvnVersion
+            + "/ARTIFACTID/VERSION/ARTIFACTID-VERSION-CLASSIFIER.EXTENSION.md5" ).exists() );
+        assertFalse( new File( localRepo, "GROUPID-" + mvnVersion
+            + "/ARTIFACTID/VERSION/ARTIFACTID-VERSION-CLASSIFIER.EXTENSION.sha1" ).exists() );
         assertTrue( new File( localRepo, "GROUPID-" + mvnVersion + "/ARTIFACTID/maven-metadata-local.xml" ).exists() ); // ??
 
     }

Modified: maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/main/java/org/apache/maven/shared/project/deploy/internal/DefaultProjectDeployer.java
URL: http://svn.apache.org/viewvc/maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/main/java/org/apache/maven/shared/project/deploy/internal/DefaultProjectDeployer.java?rev=1805658&r1=1805657&r2=1805658&view=diff
==============================================================================
--- maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/main/java/org/apache/maven/shared/project/deploy/internal/DefaultProjectDeployer.java (original)
+++ maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/main/java/org/apache/maven/shared/project/deploy/internal/DefaultProjectDeployer.java Mon Aug 21 18:34:20 2017
@@ -85,6 +85,9 @@ public class DefaultProjectDeployer
             artifact.addMetadata( metadata );
         }
 
+        //FIXME: It does not make sense to set an artifact explicitly to a "Release"
+        // cause this should be choosen only by the not existing of "-SNAPSHOT" in the
+        // version.
         if ( request.isUpdateReleaseInfo() )
         {
             artifact.setRelease( true );

Added: maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/site/apt/deploy-project.apt
URL: http://svn.apache.org/viewvc/maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/site/apt/deploy-project.apt?rev=1805658&view=auto
==============================================================================
--- maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/site/apt/deploy-project.apt (added)
+++ maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/site/apt/deploy-project.apt Mon Aug 21 18:34:20 2017
@@ -0,0 +1,58 @@
+ -----
+ Deploy Project
+ -----
+ Karl Heinz Marbaise
+ -----
+ 2017-08-20
+ -----
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
+
+Deploy a Project
+
+  If you are developing a maven plugin you need often to deploy a whole project 
+  into a repository which is a little bit cumbersome. This can be easily 
+  done via the following code parts.
+
++---  
+   @Parameter ( defaultValue = "${session}", required = true, readonly = true)
+   private MavenSession session;
+   @Parameter ( defaultValue = "${project}", required = true, readonly = true)
+   private MavenProject project;
+
+   @Component
+   private ProjectDeployer deployer;
+   ...
+   public void execute() {
+      
+      ProjectDeployerRequest pir =
+           new ProjectDeployerRequest()
+           //TODO: Think about setUpdateReleaseInfo()..
+             .setProject( project ).setUpdateReleaseInfo( true );
+             
+      deployer.deploy( session.getProjectBuildingRequest(), pir );
+      ...
+   }
+   
++---
+
+   
+   
\ No newline at end of file

Modified: maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/site/apt/install-project.apt
URL: http://svn.apache.org/viewvc/maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/site/apt/install-project.apt?rev=1805658&r1=1805657&r2=1805658&view=diff
==============================================================================
--- maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/site/apt/install-project.apt (original)
+++ maven/shared/branches/maven-artifact-transfer-MSHARED-656/src/site/apt/install-project.apt Mon Aug 21 18:34:20 2017
@@ -28,9 +28,9 @@
 
 Install a Project
 
-  If you are developing a maven plugin you need often to install artifacts 
-  into the local repository which is a little bit cumbersome. This can be easily 
-  done via the following code parts.
+  If you are developing a maven plugin or other components related to Maven you need
+  often to install artifacts into the local repository which is a little bit cumbersome. 
+  This can be easily done via the following code parts.
 
 +---  
    @Parameter ( defaultValue = "${session}", required = true, readonly = true)
@@ -45,8 +45,9 @@ Install a Project
       
       ProjectInstallerRequest pir =
            new ProjectInstallerRequest()
+           //TODO: THink about setUpdateReleaseInfo()..
              .setProject( project ).setUpdateReleaseInfo( updateReleaseInfo );
-             
+
       installer.install( session.getProjectBuildingRequest(), pir );
       ...
    }