Return-Path: Delivered-To: apmail-maven-commits-archive@www.apache.org Received: (qmail 79946 invoked from network); 8 Sep 2010 22:38:47 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Sep 2010 22:38:47 -0000 Received: (qmail 94073 invoked by uid 500); 8 Sep 2010 22:38:47 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 93996 invoked by uid 500); 8 Sep 2010 22:38:46 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 93989 invoked by uid 99); 8 Sep 2010 22:38:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Sep 2010 22:38:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Sep 2010 22:38:42 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 07B5423889F1; Wed, 8 Sep 2010 22:38:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r995270 - in /maven/core-integration-testing/trunk: core-it-suite/src/test/java/org/apache/maven/it/ core-it-suite/src/test/resources/mng-4788/ core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/c... Date: Wed, 08 Sep 2010 22:38:20 -0000 To: commits@maven.apache.org From: bentmann@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100908223821.07B5423889F1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bentmann Date: Wed Sep 8 22:38:20 2010 New Revision: 995270 URL: http://svn.apache.org/viewvc?rev=995270&view=rev Log: [MNG-4788] [regression] Appassembler Maven Plugin doesn't work like as it should o Added IT Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4788InstallationToCustomLocalRepoTest.java (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4788/ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4788/pom.xml (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/CustomRepositoryLayout.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/InstallCustomMojo.java (with props) Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java 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 Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=995270&r1=995269&r2=995270&view=diff ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java (original) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java Wed Sep 8 22:38:20 2010 @@ -85,6 +85,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng4795DepResolutionInReactorProjectForkedByLifecycleTest.class ); suite.addTestSuite( MavenITmng4791ProjectBuilderResolvesRemotePomArtifactTest.class ); suite.addTestSuite( MavenITmng4789ScopeInheritanceMeetsConflictTest.class ); + suite.addTestSuite( MavenITmng4788InstallationToCustomLocalRepoTest.class ); suite.addTestSuite( MavenITmng4786AntBased21xMojoSupportTest.class ); suite.addTestSuite( MavenITmng4781DeploymentToNexusStagingRepoTest.class ); suite.addTestSuite( MavenITmng4779MultipleDepsWithVersionRangeFromLocalRepoTest.class ); Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4788InstallationToCustomLocalRepoTest.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4788InstallationToCustomLocalRepoTest.java?rev=995270&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4788InstallationToCustomLocalRepoTest.java (added) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4788InstallationToCustomLocalRepoTest.java Wed Sep 8 22:38:20 2010 @@ -0,0 +1,62 @@ +package org.apache.maven.it; + +/* + * 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.it.Verifier; +import org.apache.maven.it.util.ResourceExtractor; + +import java.io.File; +import java.util.List; +import java.util.Properties; + +/** + * This is a test set for MNG-4788. + * + * @author Benjamin Bentmann + */ +public class MavenITmng4788InstallationToCustomLocalRepoTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng4788InstallationToCustomLocalRepoTest() + { + super( "[2.0.3,3.0-alpha-1),[3.0-beta-4,)" ); + } + + /** + * Verify that plugins can install artifacts to a custom local repo (i.e. custom base dir and custom layout). + */ + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4788" ); + + Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier.assertFilePresent( "target/local-repo/test-0.1-SNAPSHOT.jar" ); + verifier.assertFileNotPresent( "target/local-repo/org/apache/maven/its/mng4788/test/0.1-SNAPSHOT/test-0.1-SNAPSHOT.jar" ); + } + +} Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4788InstallationToCustomLocalRepoTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4788InstallationToCustomLocalRepoTest.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4788/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4788/pom.xml?rev=995270&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4788/pom.xml (added) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4788/pom.xml Wed Sep 8 22:38:20 2010 @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4788 + 0.1-SNAPSHOT + test + jar + + Maven Integration Test :: MNG-4788 + + Verify that plugins can install artifacts to a custom local repo (i.e. custom base dir and custom layout). + + + + + + org.apache.maven.its.plugins + maven-it-plugin-artifact + 2.1-SNAPSHOT + + + deploy + validate + + set + install-custom + + + pom.xml + target/local-repo + + + + + + + Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4788/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4788/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/CustomRepositoryLayout.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/CustomRepositoryLayout.java?rev=995270&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/CustomRepositoryLayout.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/CustomRepositoryLayout.java Wed Sep 8 22:38:20 2010 @@ -0,0 +1,66 @@ +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.handler.ArtifactHandler; +import org.apache.maven.artifact.metadata.ArtifactMetadata; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; + +/** + * @author Benjamin Bentmann + */ +public class CustomRepositoryLayout + implements ArtifactRepositoryLayout +{ + + public String pathOf( Artifact artifact ) + { + ArtifactHandler artifactHandler = artifact.getArtifactHandler(); + + StringBuffer path = new StringBuffer(); + + path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() ); + + if ( artifact.hasClassifier() ) + { + path.append( '-' ).append( artifact.getClassifier() ); + } + + if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 ) + { + path.append( '.' ).append( artifactHandler.getExtension() ); + } + + return path.toString(); + } + + public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository ) + { + return metadata.getLocalFilename( repository ); + } + + public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata ) + { + return metadata.getRemoteFilename(); + } + +} Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/CustomRepositoryLayout.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/CustomRepositoryLayout.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=995270&r1=995269&r2=995270&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 Wed Sep 8 22:38:20 2010 @@ -23,7 +23,6 @@ import org.apache.maven.artifact.Artifac import org.apache.maven.artifact.deployer.ArtifactDeployer; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; import java.util.Iterator; @@ -62,7 +61,7 @@ public class DeployMojo * @throws MojoExecutionException If any artifact could not be installed. */ public void execute() - throws MojoExecutionException, MojoFailureException + throws MojoExecutionException { getLog().info( "[MAVEN-CORE-IT-LOG] Deploying project artifacts" ); Added: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallCustomMojo.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/InstallCustomMojo.java?rev=995270&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/InstallCustomMojo.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/InstallCustomMojo.java Wed Sep 8 22:38:20 2010 @@ -0,0 +1,76 @@ +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 java.io.File; + +import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; +import org.apache.maven.plugin.MojoExecutionException; + +/** + * Installs the project artifacts into a local repository with a custom base directory and a custom layout. + * + * @goal install-custom + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class InstallCustomMojo + extends InstallMojo +{ + + /** + * @component + */ + private ArtifactRepositoryFactory repositoryFactory; + + /** + * The base directory of the local repository to install to. + * + * @parameter expression="${install.localRepoDir}" + */ + private String localRepoDir; + + /** + * Runs this mojo. + * + * @throws MojoExecutionException If any artifact could not be installed. + */ + public void execute() + throws MojoExecutionException + { + try + { + String url = "file://" + new File( localRepoDir ).toURL().getPath(); + + localRepository = + repositoryFactory.createArtifactRepository( localRepository.getId(), url, new CustomRepositoryLayout(), + localRepository.getSnapshots(), + localRepository.getReleases() ); + } + catch ( Exception e ) + { + throw new MojoExecutionException( "Failed to create custom local repository", e ); + } + + super.execute(); + } + +} Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/InstallCustomMojo.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/InstallCustomMojo.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/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=995270&r1=995269&r2=995270&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 Wed Sep 8 22:38:20 2010 @@ -22,7 +22,6 @@ package org.apache.maven.plugin.coreit; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.installer.ArtifactInstaller; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; import java.util.Iterator; @@ -52,7 +51,7 @@ public class InstallMojo * @throws MojoExecutionException If any artifact could not be installed. */ public void execute() - throws MojoExecutionException, MojoFailureException + throws MojoExecutionException { getLog().info( "[MAVEN-CORE-IT-LOG] Installing project artifacts" );