maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r696629 [2/7] - in /maven/components/branches/jvz: ./ maven-core-it-runner/ maven-core/ maven-core/src/main/aspect/ maven-core/src/main/java/org/apache/maven/ maven-core/src/main/java/org/apache/maven/errors/ maven-core/src/main/java/org/ap...
Date Thu, 18 Sep 2008 11:10:00 GMT
Modified: maven/components/branches/jvz/maven-embedder/src/test/projects/complex-project/maven-project/src/test/resources/org/apache/maven/project/ProjectClasspathTest.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-embedder/src/test/projects/complex-project/maven-project/src/test/resources/org/apache/maven/project/ProjectClasspathTest.xml?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-embedder/src/test/projects/complex-project/maven-project/src/test/resources/org/apache/maven/project/ProjectClasspathTest.xml
(original)
+++ maven/components/branches/jvz/maven-embedder/src/test/projects/complex-project/maven-project/src/test/resources/org/apache/maven/project/ProjectClasspathTest.xml
Thu Sep 18 04:09:54 2008
@@ -81,7 +81,7 @@
       <implementation>org.apache.maven.project.TestProjectBuilder</implementation>
       <requirements>
         <requirement>
-          <role>org.apache.maven.project.build.model.ModelLineageBuilder</role>
+          <role>org.apache.maven.extension.lineage.ModelLineageBuilder</role>
           <role-hint>default</role-hint>
         </requirement>
         <requirement>
@@ -92,19 +92,13 @@
           <role>org.apache.maven.profiles.MavenProfilesBuilder</role>
         </requirement>
         <requirement>
-          <role>org.apache.maven.project.injection.ModelDefaultsInjector</role>
-        </requirement>
-        <requirement>
-          <role>org.apache.maven.project.interpolation.ModelInterpolator</role>
-        </requirement>
-        <requirement>
           <role>org.apache.maven.project.inheritance.ModelInheritanceAssembler</role>
         </requirement>
         <requirement>
           <role>org.apache.maven.project.validation.ModelValidator</role>
         </requirement>
         <requirement>
-          <role>org.apache.maven.project.path.PathTranslator</role>
+          <role>org.apache.maven.path.PathTranslator</role>
         </requirement>
         <requirement>
           <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
@@ -121,5 +115,28 @@
         </requirement>
       </requirements>
     </component>
+    <component>
+      <role>org.apache.maven.extension.lineage.ModelLineageBuilder</role>
+      <role-hint>default</role-hint>
+      <implementation>org.apache.maven.extension.lineage.DefaultModelLineageBuilder</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.project.workspace.ProjectWorkspace</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.profiles.build.ProfileAdvisor</role>
+          <role-hint>default</role-hint>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.MavenTools</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
+        </requirement>
+      </requirements>
+    </component>      
   </components>
 </plexus>

Modified: maven/components/branches/jvz/maven-embedder/src/test/projects/complex-project/maven-project/src/test/resources/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-embedder/src/test/projects/complex-project/maven-project/src/test/resources/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.xml?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-embedder/src/test/projects/complex-project/maven-project/src/test/resources/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.xml
(original)
+++ maven/components/branches/jvz/maven-embedder/src/test/projects/complex-project/maven-project/src/test/resources/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.xml
Thu Sep 18 04:09:54 2008
@@ -79,10 +79,6 @@
       <implementation>org.apache.maven.project.TestProjectBuilder</implementation>
       <requirements>
         <requirement>
-          <role>org.apache.maven.project.build.model.ModelLineageBuilder</role>
-          <role-hint>default</role-hint>
-        </requirement>
-        <requirement>
           <role>org.apache.maven.profiles.build.ProfileAdvisor</role>
           <role-hint>default</role-hint>
         </requirement>
@@ -90,19 +86,10 @@
           <role>org.apache.maven.profiles.MavenProfilesBuilder</role>
         </requirement>
         <requirement>
-          <role>org.apache.maven.project.injection.ModelDefaultsInjector</role>
-        </requirement>
-        <requirement>
-          <role>org.apache.maven.project.interpolation.ModelInterpolator</role>
-        </requirement>
-        <requirement>
-          <role>org.apache.maven.project.inheritance.ModelInheritanceAssembler</role>
-        </requirement>
-        <requirement>
           <role>org.apache.maven.project.validation.ModelValidator</role>
         </requirement>
         <requirement>
-          <role>org.apache.maven.project.path.PathTranslator</role>
+          <role>org.apache.maven.path.PathTranslator</role>
         </requirement>
         <requirement>
           <role>org.apache.maven.artifact.factory.ArtifactFactory</role>

Modified: maven/components/branches/jvz/maven-project/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-project/pom.xml?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-project/pom.xml (original)
+++ maven/components/branches/jvz/maven-project/pom.xml Thu Sep 18 04:09:54 2008
@@ -74,21 +74,4 @@
       <artifactId>maven-shared-model</artifactId>
     </dependency> 
   </dependencies>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>aspectj-maven-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>compile-aspects</id>
-            <phase>compile</phase>
-            <goals>
-              <goal>compile</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
 </project>

Modified: maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/DefaultMavenTools.java
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/DefaultMavenTools.java?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/DefaultMavenTools.java
(original)
+++ maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/DefaultMavenTools.java
Thu Sep 18 04:09:54 2008
@@ -32,7 +32,9 @@
 import java.util.Iterator;
 import java.util.List;
 
-/** @author Jason van Zyl */
+/**
+ * @author Jason van Zyl
+ */
 public class DefaultMavenTools
     implements MavenTools
 {
@@ -94,7 +96,8 @@
 
             if ( url == null || url.trim().length() < 1 )
             {
-                throw new MissingRepositoryElementException( "Repository URL must not be
empty (ID is: " + id + ").", id );
+                throw new MissingRepositoryElementException( "Repository URL must not be
empty (ID is: " + id + ").",
+                                                             id );
             }
 
             ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots()
);

Modified: maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java
(original)
+++ maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java
Thu Sep 18 04:09:54 2008
@@ -22,18 +22,14 @@
 import org.apache.maven.model.Activation;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Profile;
+import org.apache.maven.model.Parent;
 import org.apache.maven.profiles.activation.DefaultProfileActivationContext;
 import org.apache.maven.profiles.activation.ProfileActivationContext;
 import org.apache.maven.profiles.activation.ProfileActivationException;
 import org.apache.maven.profiles.activation.ProfileActivator;
-import org.apache.maven.project.ModelUtils;
-import org.apache.maven.realm.DefaultMavenRealmManager;
-import org.apache.maven.realm.MavenRealmManager;
 import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.classworlds.realm.ClassRealm;
 import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import org.codehaus.plexus.logging.Logger;
 
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -54,7 +50,6 @@
     /**
      * the properties passed to the profile manager are the props that
      * are passed to maven, possibly containing profile activator properties
-     *
      */
     public DefaultProfileManager( PlexusContainer container, ProfileActivationContext profileActivationContext
)
     {
@@ -82,11 +77,8 @@
 
     private ProfileActivationContext createDefaultActivationContext()
     {
-        // create the necessary bits to get a skeletal profile manager running.
-        Logger logger = container.getLoggerManager().getLoggerForComponent( DefaultProfileManager.class.getName()
);
-        MavenRealmManager manager = new DefaultMavenRealmManager( container, logger );
 
-        return new DefaultProfileActivationContext( manager, System.getProperties(), false
);
+        return new DefaultProfileActivationContext(System.getProperties(), false );
     }
 
     public ProfileActivationContext getProfileActivationContext()
@@ -185,22 +177,12 @@
     public List getActiveProfiles()
         throws ProfileActivationException
     {
-         return getActiveProfiles( null );
+        return getActiveProfiles( null );
     }
 
     public List getActiveProfiles( Model model )
         throws ProfileActivationException
     {
-        MavenRealmManager realmManager = profileActivationContext.getRealmManager();
-
-        ClassRealm projectRealm = null;
-        ClassRealm oldLookupRealm = null;
-
-        if ( ( model != null ) && ( realmManager != null ) )
-        {
-            projectRealm = realmManager.getProjectRealm( ModelUtils.getGroupId( model ),
model.getArtifactId(), ModelUtils.getVersion( model ) );
-            oldLookupRealm = container.setLookupRealm( projectRealm );
-        }
 
         try
         {
@@ -241,18 +223,18 @@
             {
                 List defaultIds = profileActivationContext.getActiveByDefaultProfileIds();
 
-				List deactivatedIds = profileActivationContext.getExplicitlyInactiveProfileIds();
-				
+                List deactivatedIds = profileActivationContext.getExplicitlyInactiveProfileIds();
+
                 for ( Iterator it = defaultIds.iterator(); it.hasNext(); )
                 {
                     String profileId = (String) it.next();
-					
-					// If this profile was excluded, don't add it back in
-					// Fixes MNG-3545
-					if (deactivatedIds.contains(profileId)) 
-					{
-						continue;
-					}
+
+                    // If this profile was excluded, don't add it back in
+                    // Fixes MNG-3545
+                    if ( deactivatedIds.contains( profileId ) )
+                    {
+                        continue;
+                    }
                     Profile profile = (Profile) profilesById.get( profileId );
 
                     if ( profile != null )
@@ -271,10 +253,6 @@
         }
         finally
         {
-            if ( projectRealm != null )
-            {
-                container.setLookupRealm( oldLookupRealm );
-            }
         }
     }
 
@@ -295,7 +273,8 @@
                 {
                     if ( activator.isActive( profile, context ) )
                     {
-                        container.getLogger().debug( "Profile: " + profile.getId() + " is
active. (source: " + profile.getSource() + ")" );
+                        container.getLogger().debug(
+                            "Profile: " + profile.getId() + " is active. (source: " + profile.getSource()
+ ")" );
                         return true;
                     }
                 }
@@ -309,7 +288,7 @@
         }
         finally
         {
-            container.getContext().put("SystemProperties", null);
+            container.getContext().put( "SystemProperties", null );
             if ( activators != null )
             {
                 try
@@ -361,4 +340,30 @@
     {
         return profileActivationContext.getActiveByDefaultProfileIds();
     }
+
+    private static String getVersion( Model model )
+    {
+        Parent parent = model.getParent();
+
+        String version = model.getVersion();
+        if ( ( parent != null ) && ( version == null ) )
+        {
+            version = parent.getVersion();
+        }
+
+        return version;
+    }
+
+    public static String getGroupId( Model model )
+    {
+        Parent parent = model.getParent();
+
+        String groupId = model.getGroupId();
+        if ( ( parent != null ) && ( groupId == null ) )
+        {
+            groupId = parent.getGroupId();
+        }
+
+        return groupId;
+    }
 }

Modified: maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/CustomActivator.java
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/CustomActivator.java?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/CustomActivator.java
(original)
+++ maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/CustomActivator.java
Thu Sep 18 04:09:54 2008
@@ -90,8 +90,9 @@
         {
             if ( !context.isCustomActivatorFailureSuppressed() )
             {
-                throw new ProfileActivationException( "Cannot find custom ProfileActivator:
" + type
-                    + ". \nPerhaps you're missing a build extension?", e );
+                throw new ProfileActivationException(
+                    "Cannot find custom ProfileActivator: " + type + ". \nPerhaps you're
missing a build extension?",
+                    e );
             }
         }
 
@@ -107,8 +108,7 @@
         {
             if ( !context.isCustomActivatorFailureSuppressed() )
             {
-                throw new ProfileActivationException( "Failed to configure custom ProfileActivator:
" + type
-                    + ".", e );
+                throw new ProfileActivationException( "Failed to configure custom ProfileActivator:
" + type + ".", e );
             }
         }
 

Modified: maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/DefaultProfileActivationContext.java
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/DefaultProfileActivationContext.java?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/DefaultProfileActivationContext.java
(original)
+++ maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/DefaultProfileActivationContext.java
Thu Sep 18 04:09:54 2008
@@ -1,6 +1,24 @@
 package org.apache.maven.profiles.activation;
 
-import org.apache.maven.realm.MavenRealmManager;
+/*
+ * 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.util.ArrayList;
 import java.util.Collections;
@@ -12,22 +30,17 @@
 {
 
     private boolean isCustomActivatorFailureSuppressed;
+
     private final Properties executionProperties;
+
     List explicitlyActive;
+
     List explicitlyInactive;
-    private final MavenRealmManager realmManager;
-    private List activeByDefault;
 
-    public DefaultProfileActivationContext( MavenRealmManager realmManager, Properties executionProperties,
boolean isCustomActivatorFailureSuppressed )
-    {
-        this.realmManager = realmManager;
-        this.executionProperties = executionProperties;
-        this.isCustomActivatorFailureSuppressed = isCustomActivatorFailureSuppressed;
-    }
+    private List activeByDefault;
 
     public DefaultProfileActivationContext( Properties executionProperties, boolean isCustomActivatorFailureSuppressed
)
     {
-        realmManager = null;
         this.executionProperties = executionProperties;
         this.isCustomActivatorFailureSuppressed = isCustomActivatorFailureSuppressed;
     }
@@ -77,11 +90,6 @@
         explicitlyInactive = inactive;
     }
 
-    public MavenRealmManager getRealmManager()
-    {
-        return realmManager;
-    }
-
     public void setActive( String profileId )
     {
         if ( explicitlyActive == null )

Modified: maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java
(original)
+++ maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java
Thu Sep 18 04:09:54 2008
@@ -76,11 +76,13 @@
                 {
                     if ( logger.isDebugEnabled() )
                     {
-                        logger.debug( "Failed to interpolate exists file location for profile
activator: " + fileString, e );
+                        logger.debug( "Failed to interpolate exists file location for profile
activator: " + fileString,
+                                      e );
                     }
                     else
                     {
-                        logger.warn( "Failed to interpolate exists file location for profile
activator: " + fileString + ". Run in debug mode (-X) for more information." );
+                        logger.warn( "Failed to interpolate exists file location for profile
activator: " + fileString +
+                            ". Run in debug mode (-X) for more information." );
                     }
                 }
 
@@ -88,7 +90,8 @@
 
                 if ( logger != null )
                 {
-                    logger.debug( "FileProfileActivator: Checking file existence for: " +
fileString + ". Result: " + result );
+                    logger.debug(
+                        "FileProfileActivator: Checking file existence for: " + fileString
+ ". Result: " + result );
                 }
 
                 return result;
@@ -107,11 +110,13 @@
                 {
                     if ( logger.isDebugEnabled() )
                     {
-                        logger.debug( "Failed to interpolate missing file location for profile
activator: " + fileString, e );
+                        logger.debug(
+                            "Failed to interpolate missing file location for profile activator:
" + fileString, e );
                     }
                     else
                     {
-                        logger.warn( "Failed to interpolate missing file location for profile
activator: " + fileString + ". Run in debug mode (-X) for more information." );
+                        logger.warn( "Failed to interpolate missing file location for profile
activator: " +
+                            fileString + ". Run in debug mode (-X) for more information."
);
                     }
                 }
 
@@ -119,7 +124,8 @@
 
                 if ( logger != null )
                 {
-                    logger.debug( "FileProfileActivator: Checking file is missing for: "
+ fileString + ". Result: " + result );
+                    logger.debug(
+                        "FileProfileActivator: Checking file is missing for: " + fileString
+ ". Result: " + result );
                 }
 
                 return result;

Modified: maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java
(original)
+++ maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java
Thu Sep 18 04:09:54 2008
@@ -43,7 +43,8 @@
         String javaVersion = props.getProperty( JDK_VERSION );
         if ( javaVersion == null )
         {
-            getLogger().warn( "Cannot locate java version property: " + JDK_VERSION + ".
NOT enabling profile: " + profile.getId() );
+            getLogger().warn(
+                "Cannot locate java version property: " + JDK_VERSION + ". NOT enabling profile:
" + profile.getId() );
             return false;
         }
 
@@ -100,7 +101,8 @@
         }
     }
 
-    /** This method transforms a string like "1.5.0_06" into
+    /**
+     * This method transforms a string like "1.5.0_06" into
      * new int[]{1, 5, 0, 6}.
      */
     private static int[] asIntArray( String pVersion )
@@ -129,7 +131,8 @@
         return result;
     }
 
-    /** This method compares to integer arrays, as created
+    /**
+     * This method compares to integer arrays, as created
      * by {@link #asIntArray(String)}.
      */
     private static int compareTo( int[] pVersion1, int[] pVersion2 )

Modified: maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java
(original)
+++ maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java
Thu Sep 18 04:09:54 2008
@@ -62,7 +62,8 @@
 
     private boolean ensureAtLeastOneNonNull( ActivationOS os )
     {
-        return ( os.getArch() != null ) || ( os.getFamily() != null ) || ( os.getName() !=
null ) || ( os.getVersion() != null );
+        return ( os.getArch() != null ) || ( os.getFamily() != null ) || ( os.getName() !=
null ) ||
+            ( os.getVersion() != null );
     }
 
     private boolean determineVersionMatch( String version )

Modified: maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/ProfileActivationContext.java
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/ProfileActivationContext.java?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/ProfileActivationContext.java
(original)
+++ maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/ProfileActivationContext.java
Thu Sep 18 04:09:54 2008
@@ -1,6 +1,24 @@
 package org.apache.maven.profiles.activation;
 
-import org.apache.maven.realm.MavenRealmManager;
+/*
+ * 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.util.List;
 import java.util.Properties;
@@ -12,8 +30,6 @@
 
     List getExplicitlyInactiveProfileIds();
 
-    MavenRealmManager getRealmManager();
-
     Properties getExecutionProperties();
 
     boolean isCustomActivatorFailureSuppressed();

Modified: maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java
(original)
+++ maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java
Thu Sep 18 04:09:54 2008
@@ -25,8 +25,10 @@
 {
     static final String ROLE = ProfileActivator.class.getName();
 
-    boolean canDetermineActivation( Profile profile, ProfileActivationContext context ) throws
ProfileActivationException;
+    boolean canDetermineActivation( Profile profile, ProfileActivationContext context )
+        throws ProfileActivationException;
 
-    boolean isActive( Profile profile, ProfileActivationContext context ) throws ProfileActivationException;
+    boolean isActive( Profile profile, ProfileActivationContext context )
+        throws ProfileActivationException;
 
 }

Modified: maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java
(original)
+++ maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java
Thu Sep 18 04:09:54 2008
@@ -46,7 +46,7 @@
             String name = property.getName();
             boolean reverseName = false;
 
-            if ( name.startsWith("!") )
+            if ( name.startsWith( "!" ) )
             {
                 reverseName = true;
                 name = name.substring( 1 );

Modified: maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/build/DefaultProfileAdvisor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/build/DefaultProfileAdvisor.java?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/build/DefaultProfileAdvisor.java
(original)
+++ maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/build/DefaultProfileAdvisor.java
Thu Sep 18 04:09:54 2008
@@ -67,25 +67,18 @@
 
     private Logger logger;
 
-    public List applyActivatedProfiles( Model model,
-                                        File pomFile,
-                                        boolean useProfilesXml,
+    public List applyActivatedProfiles( Model model, File pomFile, boolean useProfilesXml,
                                         ProfileActivationContext activationContext )
         throws ProjectBuildingException
     {
 //        logger.debug( "Building profile manager for model: " + model.getId() + " with pom
file: "
 //                      + pomFile );
-        ProfileManager profileManager = buildProfileManager( model,
-                                                             pomFile,
-                                                             useProfilesXml,
-                                                             activationContext );
+        ProfileManager profileManager = buildProfileManager( model, pomFile, useProfilesXml,
activationContext );
 
         return applyActivatedProfiles( model, pomFile, profileManager );
     }
 
-    public List applyActivatedExternalProfiles( Model model,
-                                                File projectDir,
-                                                ProfileManager externalProfileManager )
+    public List applyActivatedExternalProfiles( Model model, File projectDir, ProfileManager
externalProfileManager )
         throws ProjectBuildingException
     {
         if ( externalProfileManager == null )
@@ -99,9 +92,7 @@
         return applyActivatedProfiles( model, projectDir, externalProfileManager );
     }
 
-    private List applyActivatedProfiles( Model model,
-                                         File pomFile,
-                                         ProfileManager profileManager )
+    private List applyActivatedProfiles( Model model, File pomFile, ProfileManager profileManager
)
         throws ProjectBuildingException
     {
         List activeProfiles;
@@ -146,9 +137,7 @@
         return activeProfiles;
     }
 
-    private ProfileManager buildProfileManager( Model model,
-                                                File pomFile,
-                                                boolean useProfilesXml,
+    private ProfileManager buildProfileManager( Model model, File pomFile, boolean useProfilesXml,
                                                 ProfileActivationContext profileActivationContext
)
         throws ProjectBuildingException
     {
@@ -164,8 +153,7 @@
         return profileManager;
     }
 
-    public LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model,
-                                                                    File pomFile,
+    public LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model, File pomFile,
                                                                     ProfileManager profileManager
)
         throws ProjectBuildingException
     {
@@ -183,8 +171,7 @@
             }
             catch ( ProfileActivationException e )
             {
-                throw new ProjectBuildingException(
-                                                    model.getId(),
+                throw new ProjectBuildingException( model.getId(),
                                                     "Failed to compute active profiles for
repository aggregation.",
                                                     pomFile, e );
             }
@@ -196,7 +183,8 @@
                 Profile externalProfile = (Profile) i.next();
                 if ( externalProfile.getRepositories() != null )
                 {
-                    for ( Iterator repoIterator = externalProfile.getRepositories().iterator();
repoIterator.hasNext(); )
+                    for ( Iterator repoIterator = externalProfile.getRepositories().iterator();
+                          repoIterator.hasNext(); )
                     {
                         Repository mavenRepo = (Repository) repoIterator.next();
 
@@ -219,23 +207,16 @@
         }
     }
 
-    public LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model,
-                                                                    File pomFile,
-                                                                    boolean useProfilesXml,
+    public LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model, File pomFile,
boolean useProfilesXml,
                                                                     ProfileActivationContext
activationContext )
         throws ProjectBuildingException
     {
-        ProfileManager profileManager = buildProfileManager( model,
-                                                             pomFile,
-                                                             useProfilesXml,
-                                                             activationContext );
+        ProfileManager profileManager = buildProfileManager( model, pomFile, useProfilesXml,
activationContext );
 
         return getArtifactRepositoriesFromActiveProfiles( model, pomFile, profileManager
);
     }
 
-    private void loadExternalProjectProfiles( ProfileManager profileManager,
-                                              Model model,
-                                              File pomFile )
+    private void loadExternalProjectProfiles( ProfileManager profileManager, Model model,
File pomFile )
         throws ProjectBuildingException
     {
         if ( pomFile != null )
@@ -268,14 +249,14 @@
             catch ( IOException e )
             {
                 throw new ProjectBuildingException( model.getId(),
-                                                    "Cannot read profiles.xml resource from
directory: "
-                                                                    + projectDir, pomFile,
e );
+                                                    "Cannot read profiles.xml resource from
directory: " + projectDir,
+                                                    pomFile, e );
             }
             catch ( XmlPullParserException e )
             {
                 throw new ProjectBuildingException( model.getId(),
-                                                    "Cannot parse profiles.xml resource from
directory: "
-                                                                    + projectDir, pomFile,
e );
+                                                    "Cannot parse profiles.xml resource from
directory: " + projectDir,
+                                                    pomFile, e );
             }
         }
     }

Modified: maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/build/ProfileAdvisor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/build/ProfileAdvisor.java?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/build/ProfileAdvisor.java
(original)
+++ maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/build/ProfileAdvisor.java
Thu Sep 18 04:09:54 2008
@@ -29,35 +29,25 @@
 import java.util.List;
 
 /**
- *
  * @author jdcasey
- *
  */
 public interface ProfileAdvisor
 {
 
     String ROLE = ProfileAdvisor.class.getName();
 
-    LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model,
-                                                             File pomFile,
-                                                             ProfileManager profileManager
)
+    LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model, File pomFile, ProfileManager
profileManager )
         throws ProjectBuildingException;
 
-    LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model,
-                                                             File pomFile,
-                                                             boolean useProfilesXml,
+    LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model, File pomFile, boolean
useProfilesXml,
                                                              ProfileActivationContext profileActivationContext
)
         throws ProjectBuildingException;
 
-    List applyActivatedProfiles( Model model,
-                                 File pomFile,
-                                 boolean useProfilesXml,
+    List applyActivatedProfiles( Model model, File pomFile, boolean useProfilesXml,
                                  ProfileActivationContext activationContext )
         throws ProjectBuildingException;
 
-    List applyActivatedExternalProfiles( Model model,
-                                         File pomFile,
-                                         ProfileManager externalProfileManager )
+    List applyActivatedExternalProfiles( Model model, File pomFile, ProfileManager externalProfileManager
)
         throws ProjectBuildingException;
 
 }

Modified: maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/injection/DefaultProfileInjector.java
URL: http://svn.apache.org/viewvc/maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/injection/DefaultProfileInjector.java?rev=696629&r1=696628&r2=696629&view=diff
==============================================================================
--- maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/injection/DefaultProfileInjector.java
(original)
+++ maven/components/branches/jvz/maven-project/src/main/java/org/apache/maven/profiles/injection/DefaultProfileInjector.java
Thu Sep 18 04:09:54 2008
@@ -19,21 +19,7 @@
  * under the License.
  */
 
-import org.apache.maven.model.Build;
-import org.apache.maven.model.BuildBase;
-import org.apache.maven.model.ConfigurationContainer;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.DependencyManagement;
-import org.apache.maven.model.DistributionManagement;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Plugin;
-import org.apache.maven.model.PluginContainer;
-import org.apache.maven.model.PluginExecution;
-import org.apache.maven.model.PluginManagement;
-import org.apache.maven.model.Profile;
-import org.apache.maven.model.ReportPlugin;
-import org.apache.maven.model.ReportSet;
-import org.apache.maven.model.Reporting;
+import org.apache.maven.model.*;
 import org.apache.maven.project.ModelUtils;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
@@ -49,11 +35,11 @@
 /**
  * Inject profile data into a Model, using the profile as the dominant data source, and
  * persisting results of the injection in the Model.
- *
+ * <p/>
  * This will look similar to the ModelUtils/DefaultModelInheritanceAssembler code, but
  * they are distinct. In model inheritance, the child provides data dominance AND persists
  * the results of the merge...sort of a 'merge-out' system.
- *
+ * <p/>
  * In this system, the profile is dominant, but the model receives the merge result...sort
  * of a 'merge-in' system. The two pieces of code look like they could be combined with a
  * set of flags to determine which direction to merge 'to', but there are enough differences
@@ -120,8 +106,8 @@
             }
 
             ModelUtils.mergeFilterLists( modelBuild.getFilters(), profileBuild.getFilters()
);
-            ModelUtils.mergeResourceLists( modelBuild.getResources(), profileBuild.getResources()
);
-            ModelUtils.mergeResourceLists( modelBuild.getTestResources(), profileBuild.getTestResources()
);
+            mergeResourceLists( modelBuild.getResources(), profileBuild.getResources() );
+            mergeResourceLists( modelBuild.getTestResources(), profileBuild.getTestResources()
);
 
             injectPlugins( profileBuild, modelBuild );
 
@@ -142,15 +128,15 @@
 
     /**
      * This should be the resulting ordering of plugins after injection:
-     *
+     * <p/>
      * Given:
-     *
-     *   model: X -> A -> B -> D -> E
-     *   profile: Y -> A -> C -> D -> F
-     *
+     * <p/>
+     * model: X -> A -> B -> D -> E
+     * profile: Y -> A -> C -> D -> F
+     * <p/>
      * Result:
-     *
-     *   X -> Y -> A -> B -> C -> D -> E -> F
+     * <p/>
+     * X -> Y -> A -> B -> C -> D -> E -> F
      */
     protected void injectPlugins( PluginContainer profileContainer, PluginContainer modelContainer
)
     {
@@ -214,7 +200,8 @@
             modelPlugin.setVersion( profilePlugin.getVersion() );
         }
 
-        modelPlugin.setDependencies( injectDependencies( profilePlugin.getDependencies(),
modelPlugin.getDependencies() ) );
+        modelPlugin.setDependencies(
+            injectDependencies( profilePlugin.getDependencies(), modelPlugin.getDependencies()
) );
 
         // merge the lists of goals that are not attached to an <execution/>
         injectConfigurationContainer( profilePlugin, modelPlugin );
@@ -297,13 +284,13 @@
 
     /**
      * Merge two DOMs. Copy the dominant DOM so the original one is left unchanged.
-     * <p>
+     * <p/>
      * Use this method instead of a direct call to {@link Xpp3Dom#mergeXpp3Dom(Xpp3Dom, Xpp3Dom)}.
      * Profiles are dominant, thus they are merge targets, but they may be merged in several
times
      * (e.g. if they are inherited). So with the second merge, you don't get the profile's
original
      * DOM, but an already merged one.
      *
-     * @param dominant Dominant DOM
+     * @param dominant  Dominant DOM
      * @param recessive Recessive DOM
      * @return Merged DOM
      */
@@ -618,4 +605,15 @@
         return new ArrayList( depsMap.values() );
     }
 
+    private static void mergeResourceLists( List childResources, List parentResources )
+    {
+        for ( Iterator i = parentResources.iterator(); i.hasNext(); )
+        {
+            Resource r = (Resource) i.next();
+            if ( !childResources.contains( r ) )
+            {
+                childResources.add( r );
+            }
+        }
+    }
 }



Mime
View raw message