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/01/01 14:08:25 UTC
svn commit: r730540 - in /maven/plugins/trunk/maven-install-plugin: ./
src/it/no-main-artifact-1/ src/it/no-main-artifact-2/
src/main/java/org/apache/maven/plugin/install/
Author: bentmann
Date: Thu Jan 1 05:08:24 2009
New Revision: 730540
URL: http://svn.apache.org/viewvc?rev=730540&view=rev
Log:
[MINSTALL-18] Bad algorithm to decide if the main artifact is to be installed or not
Added:
maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/
maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/pom.xml (with props)
maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/setup.bsh (with props)
maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/verify.bsh (with props)
maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/
maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/pom.xml (with props)
maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/setup.bsh (with props)
maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/verify.bsh (with props)
Modified:
maven/plugins/trunk/maven-install-plugin/pom.xml
maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
Modified: maven/plugins/trunk/maven-install-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/pom.xml?rev=730540&r1=730539&r2=730540&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-install-plugin/pom.xml Thu Jan 1 05:08:24 2009
@@ -115,6 +115,7 @@
<settingsFile>src/it/settings.xml</settingsFile>
<addTestClassPath>true</addTestClassPath>
<goals>
+ <goal>clean</goal>
<goal>install</goal>
</goals>
</configuration>
Added: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/pom.xml?rev=730540&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/pom.xml (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/pom.xml Thu Jan 1 05:08:24 2009
@@ -0,0 +1,94 @@
+<?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>
+
+ <groupId>org.apache.maven.its.install.nma1</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <description>
+ Tests the installation of a non-POM project that has no main artifact file but only attached artifacts (see
+ MINSTALL-18, MINSTALL-40). This variant of the test checks the build when target/classes is non-existent.
+ </description>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <configuration>
+ <tasks>
+ <!--
+ NOTE: The Compiler Plugin sets this as the main artifact file, should be non-existent for this test.
+ -->
+ <delete dir="target/classes"/>
+ </tasks>
+ </configuration>
+ <executions>
+ <execution>
+ <id>delete-output-dir</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <classifier>it</classifier>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/setup.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/setup.bsh?rev=730540&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/setup.bsh (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/setup.bsh Thu Jan 1 05:08:24 2009
@@ -0,0 +1,10 @@
+import java.io.*;
+import java.util.*;
+
+import org.codehaus.plexus.util.*;
+
+File file = new File( localRepositoryPath, "org/apache/maven/its/install/nma1" );
+System.out.println( "Deleting " + file );
+FileUtils.deleteDirectory( file );
+
+return true;
Propchange: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/setup.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/setup.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/verify.bsh?rev=730540&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/verify.bsh (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/verify.bsh Thu Jan 1 05:08:24 2009
@@ -0,0 +1,19 @@
+import java.io.*;
+import java.util.*;
+
+String[] paths =
+{
+ "org/apache/maven/its/install/nma1/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT-it.jar",
+};
+
+for ( String path : paths )
+{
+ File file = new File( localRepositoryPath, path );
+ System.out.println( "Checking for existence of " + file );
+ if ( !file.isFile() )
+ {
+ throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() );
+ }
+}
+
+return true;
Propchange: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/verify.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-1/verify.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/pom.xml?rev=730540&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/pom.xml (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/pom.xml Thu Jan 1 05:08:24 2009
@@ -0,0 +1,94 @@
+<?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>
+
+ <groupId>org.apache.maven.its.install.nma2</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <description>
+ Tests the installation of a non-POM project that has no main artifact file but only attached artifacts (see
+ MINSTALL-18, MINSTALL-40). This variant of the test checks the build when target/classes is existent.
+ </description>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <configuration>
+ <tasks>
+ <!--
+ NOTE: The Compiler Plugin sets this as the main artifact file, should be existent for this test.
+ -->
+ <mkdir dir="target/classes"/>
+ </tasks>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-output-dir</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <classifier>it</classifier>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/setup.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/setup.bsh?rev=730540&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/setup.bsh (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/setup.bsh Thu Jan 1 05:08:24 2009
@@ -0,0 +1,10 @@
+import java.io.*;
+import java.util.*;
+
+import org.codehaus.plexus.util.*;
+
+File file = new File( localRepositoryPath, "org/apache/maven/its/install/nma2" );
+System.out.println( "Deleting " + file );
+FileUtils.deleteDirectory( file );
+
+return true;
Propchange: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/setup.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/setup.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/verify.bsh?rev=730540&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/verify.bsh (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/verify.bsh Thu Jan 1 05:08:24 2009
@@ -0,0 +1,19 @@
+import java.io.*;
+import java.util.*;
+
+String[] paths =
+{
+ "org/apache/maven/its/install/nma2/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT-it.jar",
+};
+
+for ( String path : paths )
+{
+ File file = new File( localRepositoryPath, path );
+ System.out.println( "Checking for existence of " + file );
+ if ( !file.isFile() )
+ {
+ throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() );
+ }
+}
+
+return true;
Propchange: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/verify.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-install-plugin/src/it/no-main-artifact-2/verify.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java?rev=730540&r1=730539&r2=730540&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java (original)
+++ maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java Thu Jan 1 05:08:24 2009
@@ -108,7 +108,7 @@
// Here, we have a temporary solution to MINSTALL-3 (isDirectory() is true if it went through compile
// but not package). We are designing in a proper solution for Maven 2.1
- if ( file != null && !file.isDirectory() )
+ if ( file != null && file.isFile() )
{
installer.install( file, artifact, localRepository );