maven2/SOURCES/maven2-2.2.1-migrate-to-ple...

82 lines
3.8 KiB
Diff

From 7b57fd654710a1a21af22642eda12f8027289986 Mon Sep 17 00:00:00 2001
From: Michal Srb <msrb@redhat.com>
Date: Wed, 3 Jul 2013 10:04:03 +0200
Subject: [PATCH] Migrate to plexus-containers-container-default
---
.../maven/profiles/DefaultProfileManager.java | 28 ++++++++++++++++++----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java b/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java
index e62d5ed..b72d515 100644
--- a/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java
+++ b/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java
@@ -26,8 +26,10 @@ import org.apache.maven.profiles.activation.ProfileActivator;
import org.apache.maven.settings.Settings;
import org.apache.maven.settings.SettingsUtils;
import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.component.factory.ComponentInstantiationException;
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;
@@ -119,8 +121,12 @@ public class DefaultProfileManager
Profile existing = (Profile) profilesById.get( profileId );
if ( existing != null )
{
- container.getLogger().warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource() +
- ") with new instance from source: " + profile.getSource() );
+ try {
+ container.lookup( Logger.class ).warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource() +
+ ") with new instance from source: " + profile.getSource() );
+ } catch ( ComponentLookupException e ) {
+ throw new RuntimeException( e );
+ }
}
profilesById.put( profile.getId(), profile );
@@ -140,7 +146,11 @@ public class DefaultProfileManager
{
if ( !activatedIds.contains( profileId ) )
{
- container.getLogger().debug( "Profile with id: \'" + profileId + "\' has been explicitly activated." );
+ try {
+ container.lookup( Logger.class ).debug( "Profile with id: \'" + profileId + "\' has been explicitly activated." );
+ } catch ( ComponentLookupException e ) {
+ throw new RuntimeException( e );
+ }
activatedIds.add( profileId );
}
@@ -166,7 +176,11 @@ public class DefaultProfileManager
{
if ( !deactivatedIds.contains( profileId ) )
{
- container.getLogger().debug( "Profile with id: \'" + profileId + "\' has been explicitly deactivated." );
+ try {
+ container.lookup( Logger.class ).debug( "Profile with id: \'" + profileId + "\' has been explicitly deactivated." );
+ } catch ( ComponentLookupException e ) {
+ throw new RuntimeException( e );
+ }
deactivatedIds.add( profileId );
}
@@ -294,7 +308,11 @@ public class DefaultProfileManager
}
catch ( ComponentLifecycleException e )
{
- container.getLogger().debug( "Error releasing profile activators - ignoring.", e );
+ try {
+ container.lookup( Logger.class ).debug( "Error releasing profile activators - ignoring.", e );
+ } catch ( ComponentLookupException ex ) {
+ throw new RuntimeException( ex );
+ }
}
}
}
--
1.8.1.4