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/09/18 22:10:01 UTC
svn commit: r696785 - in /maven/plugins/trunk/maven-invoker-plugin/src:
it/stage-local/ it/stage-local/pom.xml it/stage-local/verify.bsh
main/java/org/apache/maven/plugin/invoker/InstallMojo.java
Author: bentmann
Date: Thu Sep 18 13:10:01 2008
New Revision: 696785
URL: http://svn.apache.org/viewvc?rev=696785&view=rev
Log:
[MINVOKER-64] invoker:install does not install dependencies unless they are in the reactor
o Added integration test
Added:
maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/
maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/pom.xml (with props)
maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/verify.bsh (with props)
Modified:
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InstallMojo.java
Added: maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/pom.xml?rev=696785&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/pom.xml (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/pom.xml Thu Sep 18 13:10:01 2008
@@ -0,0 +1,61 @@
+<?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>
+
+ <groupId>test</groupId>
+ <artifactId>stage-local</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <description>
+ Test to check for staging of (runtime) dependencies directly from local repository (MINVOKER-64).
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.2</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>@pom.version@</version>
+ <configuration>
+ <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/verify.bsh?rev=696785&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/verify.bsh (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/verify.bsh Thu Sep 18 13:10:01 2008
@@ -0,0 +1,36 @@
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+
+try
+{
+ File itRepoDir = new File( basedir, "target/it-repo" );
+ System.out.println( "Checking for existence of: " + itRepoDir );
+ if ( !itRepoDir.isDirectory() )
+ {
+ System.out.println( "FAILED!" );
+ return false;
+ }
+
+ String[] files = {
+ "junit/junit/3.8.2/junit-3.8.2.pom",
+ "junit/junit/3.8.2/junit-3.8.2.jar",
+ };
+ for ( String file : files )
+ {
+ File stagedFile = new File( itRepoDir, file );
+ System.out.println( "Checking for existence of: " + stagedFile );
+ if ( !stagedFile.isFile() )
+ {
+ System.out.println( "FAILED!" );
+ return false;
+ }
+ }
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+
+return true;
Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/verify.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/stage-local/verify.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InstallMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InstallMojo.java?rev=696785&r1=696784&r2=696785&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InstallMojo.java (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InstallMojo.java Thu Sep 18 13:10:01 2008
@@ -320,9 +320,10 @@
dependencies.add( id );
}
- // install dependencies available in reactor
+ // install dependencies
try
{
+ // install dependencies from reactor
for ( Iterator it = dependencies.iterator(); it.hasNext(); )
{
String id = (String) it.next();
@@ -334,24 +335,25 @@
installProjectParents( requiredProject, testRepository );
}
}
-
+
+ // install remaining dependencies from local repository
for ( Iterator it = mvnProject.getRuntimeArtifacts().iterator(); it.hasNext(); )
{
Artifact artifact = (Artifact) it.next();
String id = ArtifactUtils.versionlessKey( artifact );
-
+
if ( dependencies.contains( id ) )
{
File artifactFile = artifact.getFile();
-
+
installArtifact( artifactFile, artifact, testRepository );
-
+
Artifact pomArtifact =
artifactFactory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(),
artifact.getVersion(), null, "pom" );
-
+
File pomFile = new File( localRepository.getBasedir(), localRepository.pathOf( pomArtifact ) );
-
+
if ( pomFile.exists() )
{
installArtifact( pomFile, pomArtifact, testRepository );