You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by si...@apache.org on 2008/07/15 06:41:32 UTC

svn commit: r676794 - in /maven/sandbox/branches/SI_MAVEN_2_1: ./ maven-core/ maven-core/src/main/java/org/apache/maven/settings/ maven-distribution/ maven-distribution/src/bin/ maven-embedder/ maven-embedder/src/test/java/org/apache/maven/embedder/ ma...

Author: sisbell
Date: Mon Jul 14 21:41:31 2008
New Revision: 676794

URL: http://svn.apache.org/viewvc?rev=676794&view=rev
Log:
Merge from trunk.

Modified:
    maven/sandbox/branches/SI_MAVEN_2_1/maven-core/pom.xml
    maven/sandbox/branches/SI_MAVEN_2_1/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
    maven/sandbox/branches/SI_MAVEN_2_1/maven-distribution/pom.xml
    maven/sandbox/branches/SI_MAVEN_2_1/maven-distribution/src/bin/mvn.bat
    maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/pom.xml
    maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractEmbedderTestCase.java
    maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/src/test/java/org/apache/maven/embedder/execution/EmbedderUsingScmPluginTest.java
    maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java
    maven/sandbox/branches/SI_MAVEN_2_1/pom.xml

Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-core/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-core/pom.xml?rev=676794&r1=676793&r2=676794&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1/maven-core/pom.xml (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1/maven-core/pom.xml Mon Jul 14 21:41:31 2008
@@ -78,6 +78,10 @@
     
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-interpolation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
     </dependency>
     <dependency>

Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java?rev=676794&r1=676793&r2=676794&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java Mon Jul 14 21:41:31 2008
@@ -24,16 +24,15 @@
 import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer;
 import org.apache.maven.settings.validation.SettingsValidationResult;
 import org.apache.maven.settings.validation.SettingsValidator;
+import org.codehaus.plexus.interpolation.EnvarBasedValueSource;
+import org.codehaus.plexus.interpolation.InterpolationException;
+import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
+import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.ReaderFactory;
-import org.codehaus.plexus.util.interpolation.EnvarBasedValueSource;
-import org.codehaus.plexus.util.interpolation.PropertiesBasedValueSource;
-import org.codehaus.plexus.util.interpolation.RegexBasedInterpolator;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
-import hidden.org.codehaus.plexus.interpolation.InterpolationException;
-
 import java.io.File;
 import java.io.IOException;
 import java.io.Reader;

Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-distribution/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-distribution/pom.xml?rev=676794&r1=676793&r2=676794&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1/maven-distribution/pom.xml (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1/maven-distribution/pom.xml Mon Jul 14 21:41:31 2008
@@ -74,10 +74,6 @@
       <groupId>easymock</groupId>
       <artifactId>easymock</artifactId>
     </dependency>
-    <dependency>
-      <groupId>commons-httpclient</groupId>
-      <artifactId>commons-httpclient</artifactId>
-    </dependency>
   </dependencies>
   <profiles>
     <profile>
@@ -245,4 +241,4 @@
       </build>
     </profile>
   </profiles>
-</project>
\ No newline at end of file
+</project>

Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-distribution/src/bin/mvn.bat
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-distribution/src/bin/mvn.bat?rev=676794&r1=676793&r2=676794&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1/maven-distribution/src/bin/mvn.bat (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1/maven-distribution/src/bin/mvn.bat Mon Jul 14 21:41:31 2008
@@ -184,6 +184,6 @@
 
 if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
 
-exit /B %ERROR_CODE%
+cmd /C exit /B %ERROR_CODE%
 
 

Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/pom.xml?rev=676794&r1=676793&r2=676794&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/pom.xml (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/pom.xml Mon Jul 14 21:41:31 2008
@@ -70,10 +70,6 @@
       <groupId>easymock</groupId>
       <artifactId>easymock</artifactId>
     </dependency>
-    <dependency>
-      <groupId>commons-httpclient</groupId>
-      <artifactId>commons-httpclient</artifactId>
-    </dependency>
   </dependencies>
   <build>
     <resources>
@@ -124,4 +120,4 @@
       </build>
     </profile>
   </profiles>
-</project>
\ No newline at end of file
+</project>

Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractEmbedderTestCase.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractEmbedderTestCase.java?rev=676794&r1=676793&r2=676794&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractEmbedderTestCase.java (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractEmbedderTestCase.java Mon Jul 14 21:41:31 2008
@@ -1,45 +1,76 @@
 package org.apache.maven.embedder;
 
 /*
- * 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.
+ * 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.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.StringTokenizer;
 
 import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
 
 public abstract class AbstractEmbedderTestCase
     extends PlexusTestCase
 {
     protected MavenEmbedder maven;
 
+    private String defaultPath;
+
+    private List defaultPathList;
+
     protected void setUp()
         throws Exception
     {
         super.setUp();
-        
+
         ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
 
-        Configuration configuration = new DefaultConfiguration()
-            .setClassLoader( classLoader )
-            .setMavenEmbedderLogger( new MavenEmbedderConsoleLogger() );
+        Configuration configuration = new DefaultConfiguration().setClassLoader( classLoader ).setMavenEmbedderLogger( new MavenEmbedderConsoleLogger() );
 
         maven = new MavenEmbedder( configuration );
+        
+        // Some help with detecting executables on the command line. We want, in some cases, to use tools that are available on the command line
+        // but if they are not present on the machine we don't want tests to fail. Case in point would be using SVN via the SCM plugin. We'll
+        // run it if we can, pass through gracefully otherwise.
+
+        defaultPath = CommandLineUtils.getSystemEnvVars().getProperty( "PATH" );
+
+        if ( defaultPath == null )
+        {
+            defaultPathList = Collections.EMPTY_LIST;
+        }
+        else
+        {
+            String separator = System.getProperty( "path.separator" );
+
+            StringTokenizer tokenizer = new StringTokenizer( defaultPath, separator );
+
+            defaultPathList = new LinkedList();
+
+            while ( tokenizer.hasMoreElements() )
+            {
+                String element = (String) tokenizer.nextElement();
+
+                defaultPathList.add( element );
+            }
+        }        
     }
 
     protected void tearDown()
@@ -47,4 +78,69 @@
     {
         maven.stop();
     }
+
+    // ----------------------------------------------------------------------
+    // ExecutableResolver Implementation
+    // ----------------------------------------------------------------------
+
+    public List getDefaultPath()
+    {
+        return defaultPathList;
+    }
+
+    public File findExecutable( String executable )
+    {
+        return findExecutable( executable, getDefaultPath() );
+    }
+
+    public File findExecutable( String executable, List path )
+    {
+        if ( StringUtils.isEmpty( executable ) )
+        {
+            throw new NullPointerException( "executable cannot be null" );
+        }
+
+        if ( path == null )
+        {
+            throw new NullPointerException( "path cannot be null" );
+        }
+
+        File f = new File( executable );
+
+        if ( f.isAbsolute() && f.isFile() )
+        {
+            return f;
+        }
+
+        if ( path == null )
+        {
+            return null;
+        }
+
+        // TODO: Need to resolve it with defaults extension of system
+        // ie. if executable is 'mvn', we must search 'mvn.bat'
+        for ( Iterator it = path.iterator(); it.hasNext(); )
+        {
+            String s = (String) it.next();
+
+            f = new File( s, executable );
+
+            if ( f.isFile() )
+            {
+                return f;
+            }
+        }
+
+        return null;
+    }
+
+    public boolean hasExecutable( String executable )
+    {
+        return hasExecutable( executable, getDefaultPath() );
+    }
+
+    public boolean hasExecutable( String executable, List path )
+    {
+        return findExecutable( executable, path ) != null;
+    }
 }

Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/src/test/java/org/apache/maven/embedder/execution/EmbedderUsingScmPluginTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/src/test/java/org/apache/maven/embedder/execution/EmbedderUsingScmPluginTest.java?rev=676794&r1=676793&r2=676794&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/src/test/java/org/apache/maven/embedder/execution/EmbedderUsingScmPluginTest.java (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1/maven-embedder/src/test/java/org/apache/maven/embedder/execution/EmbedderUsingScmPluginTest.java Mon Jul 14 21:41:31 2008
@@ -1,22 +1,18 @@
 package org.apache.maven.embedder.execution;
 
 /*
- * 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.
+ * 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;
@@ -34,19 +30,29 @@
     public void testRunningScmPlugin()
         throws Exception
     {
-        File svnDirectory = new File( getBasedir(), ".svn" );
-
-        if ( svnDirectory.exists() )
+        if ( hasExecutable( "svn" ) )
         {
-            Properties p = new Properties();
+            File svnDirectory = new File( getBasedir(), ".svn" );
+
+            if ( svnDirectory.exists() )
+            {
+                Properties p = new Properties();
 
-            File outputDirectory = new File( getBasedir(), "target/scm.diff" );
+                File outputDirectory = new File( getBasedir(), "target/scm.diff" );
 
-            p.setProperty( "outputDirectory", outputDirectory.getCanonicalPath() );
+                p.setProperty( "outputDirectory", outputDirectory.getCanonicalPath() );
 
-            p.setProperty( "connectionUrl", "scm:svn:http://svn.apache.org/repos/asf/maven/components/trunk/maven-embedder" );
+                p.setProperty( "connectionUrl", "scm:svn:http://svn.apache.org/repos/asf/maven/components/trunk/maven-embedder" );
 
-            File basedir = runWithProject( "org.apache.maven.plugins:maven-scm-plugin:1.0:diff", p );
+                runWithProject( "org.apache.maven.plugins:maven-scm-plugin:1.0:diff", p );
+                
+                System.out.println( "SVN is available on this system, so we're running this SVN-related test." );                
+            }
+        }
+        else
+        {
+            System.out.println( "SVN is not available on this system, so we're not running this SVN-related test." );
         }
+       
     }
 }

Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java?rev=676794&r1=676793&r2=676794&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java Mon Jul 14 21:41:31 2008
@@ -22,15 +22,14 @@
 import org.apache.maven.model.Activation;
 import org.apache.maven.model.ActivationFile;
 import org.apache.maven.model.Profile;
+import org.codehaus.plexus.interpolation.EnvarBasedValueSource;
+import org.codehaus.plexus.interpolation.InterpolationException;
+import org.codehaus.plexus.interpolation.MapBasedValueSource;
+import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
 import org.codehaus.plexus.logging.LogEnabled;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.interpolation.EnvarBasedValueSource;
-import org.codehaus.plexus.util.interpolation.MapBasedValueSource;
-import org.codehaus.plexus.util.interpolation.RegexBasedInterpolator;
-
-import hidden.org.codehaus.plexus.interpolation.InterpolationException;
 
 import java.io.IOException;
 

Modified: maven/sandbox/branches/SI_MAVEN_2_1/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/pom.xml?rev=676794&r1=676793&r2=676794&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1/pom.xml (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1/pom.xml Mon Jul 14 21:41:31 2008
@@ -245,9 +245,8 @@
   <properties>
     <artifactVersion>3.0-SNAPSHOT</artifactVersion>
     <aspectjVersion>1.5.3</aspectjVersion>
-    <classWorldsVersion>1.2-alpha-12</classWorldsVersion>
+    <classWorldsVersion>1.2-alpha-13</classWorldsVersion>
     <commonsCliVersion>1.0</commonsCliVersion>
-    <commonsHttpClientVersion>3.1</commonsHttpClientVersion>
     <doxiaVersion>1.0-alpha-9</doxiaVersion>
     <easyMockVersion>1.2_Java1.3</easyMockVersion>
     <junitVersion>3.8.1</junitVersion>
@@ -398,12 +397,6 @@
         <scope>test</scope>
       </dependency>
       <dependency>
-        <groupId>commons-httpclient</groupId>
-        <artifactId>commons-httpclient</artifactId>
-        <version>${commonsHttpClientVersion}</version>
-        <scope>test</scope>
-      </dependency>
-      <dependency>
         <groupId>commons-cli</groupId>
         <artifactId>commons-cli</artifactId>
         <version>${commonsCliVersion}</version>