mirror of https://github.com/apache/maven.git
Removed remaining activator interfaces and uses.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@748216 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ed13b8620d
commit
c002a8d22e
|
@ -13,7 +13,6 @@ import org.apache.maven.model.Profile;
|
|||
import org.apache.maven.model.Repository;
|
||||
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.execution.DuplicateProjectException;
|
||||
import org.apache.maven.project.InvalidProjectModelException;
|
||||
import org.apache.maven.project.InvalidProjectVersionException;
|
||||
|
@ -74,7 +73,6 @@ public class DefaultProjectErrorReporter
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ProjectErrorReporter#hasInformationFor(java.lang.Throwable)
|
||||
*/
|
||||
public Throwable findReportedException( Throwable error )
|
||||
{
|
||||
|
@ -137,48 +135,7 @@ public class DefaultProjectErrorReporter
|
|||
formattedMessages.put( error, formattedMessage );
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ProjectErrorReporter#reportActivatorErrorWhileApplyingProfiles(org.apache.maven.profiles.activation.ProfileActivator, org.apache.maven.model.Model, java.io.File, org.apache.maven.model.Profile, org.apache.maven.profiles.activation.ProfileActivationContext, org.apache.maven.profiles.activation.ProfileActivationException)
|
||||
*/
|
||||
public void reportActivatorError( ProfileActivator activator,
|
||||
Model model,
|
||||
File pomFile,
|
||||
Profile profile,
|
||||
ProfileActivationContext context,
|
||||
ProfileActivationException cause )
|
||||
{
|
||||
StringWriter writer = new StringWriter();
|
||||
|
||||
writer.write( NEWLINE );
|
||||
writer.write( "Profile activator: " );
|
||||
writer.write( activator.getClass().getName() );
|
||||
writer.write( " experienced an error while processing profile:" );
|
||||
writer.write( NEWLINE );
|
||||
writer.write( NEWLINE );
|
||||
writer.write( profile.getId() );
|
||||
writer.write( " (source: " );
|
||||
writer.write( profile.getSource() );
|
||||
writer.write( ")" );
|
||||
writer.write( NEWLINE );
|
||||
writer.write( NEWLINE );
|
||||
writer.write( "Error message: " );
|
||||
writer.write( NEWLINE );
|
||||
writer.write( cause.getMessage() );
|
||||
|
||||
addStandardInfo( model.getId(), pomFile, writer );
|
||||
addTips( ProjectErrorTips.getTipsForActivatorError( activator,
|
||||
model.getId(),
|
||||
pomFile,
|
||||
profile,
|
||||
context,
|
||||
cause ), writer );
|
||||
|
||||
registerBuildError( cause, writer.toString(), cause.getCause() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ProjectErrorReporter#reportActivatorLookupError(java.lang.String, java.io.File, org.apache.maven.model.Profile, org.codehaus.plexus.component.repository.exception.ComponentLookupException)
|
||||
*/
|
||||
public void reportActivatorLookupError( Model model,
|
||||
File pomFile,
|
||||
Profile profile,
|
||||
|
@ -275,9 +232,7 @@ public class DefaultProjectErrorReporter
|
|||
registerBuildError( cause, writer.toString(), cause.getCause() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ProjectErrorReporter#reportInvalidRepositoryWhileGettingRepositoriesFromProfiles(org.apache.maven.model.Repository, java.lang.String, java.io.File, org.apache.maven.artifact.InvalidRepositoryException)
|
||||
*/
|
||||
|
||||
public void reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( Repository repo,
|
||||
Model model,
|
||||
File pomFile,
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.apache.maven.model.Profile;
|
|||
import org.apache.maven.model.Repository;
|
||||
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.execution.DuplicateProjectException;
|
||||
import org.apache.maven.project.InvalidProjectModelException;
|
||||
import org.apache.maven.project.InvalidProjectVersionException;
|
||||
|
@ -35,29 +34,6 @@ public interface ProjectErrorReporter
|
|||
|
||||
boolean isStackTraceRecommended( Throwable error );
|
||||
|
||||
/**
|
||||
* <b>Call Stack:</b>
|
||||
* <br/>
|
||||
* <pre>
|
||||
* DefaultProfileAdvisor.applyActivatedProfiles(..)
|
||||
* DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
|
||||
* --> DefaultProfileAdvisor.applyActivatedProfiles(..) (private)
|
||||
* --> DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
|
||||
* --> DefaultProfileManager.getActiveProfiles(..)
|
||||
* --> DefaultProfileManager.isActive(..) (private)
|
||||
* --> ProfileActivator.canDetermineActivation(..)
|
||||
* --> ProfileActivator.isActive(..)
|
||||
* <------ ProfileActivationException
|
||||
* <------ ProjectBuildingException
|
||||
* </pre>
|
||||
*/
|
||||
void reportActivatorError( ProfileActivator activator,
|
||||
Model model,
|
||||
File pomFile,
|
||||
Profile profile,
|
||||
ProfileActivationContext context,
|
||||
ProfileActivationException cause );
|
||||
|
||||
/**
|
||||
* <b>Call Stack:</b>
|
||||
* <br/>
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.apache.maven.model.Profile;
|
|||
import org.apache.maven.model.RepositoryBase;
|
||||
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.execution.DuplicateProjectException;
|
||||
import org.apache.maven.project.InvalidProjectVersionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
@ -32,20 +31,6 @@ public final class ProjectErrorTips
|
|||
{
|
||||
}
|
||||
|
||||
public static List getTipsForActivatorError( ProfileActivator activator,
|
||||
String projectId,
|
||||
File pomFile,
|
||||
Profile profile,
|
||||
ProfileActivationContext context,
|
||||
ProfileActivationException cause )
|
||||
{
|
||||
return listOf( new String[]{ "If this is a standard profile activator, see "
|
||||
+ "http://maven.apache.org/pom.html#Activation for help configuring profile activation.",
|
||||
"XSD location for pom.xml: http://maven.apache.org/xsd/maven-4.0.0.xsd",
|
||||
"XSD location for settings.xml: http://maven.apache.org/xsd/settings-1.0.0.xsd",
|
||||
"XSD location for profiles.xml: http://maven.apache.org/xsd/profiles-1.0.0.xsd" } );
|
||||
}
|
||||
|
||||
public static List getTipsForActivatorLookupError( String projectId,
|
||||
File pomFile,
|
||||
Profile profile,
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
package org.apache.maven.profiles;
|
||||
|
||||
/*
|
||||
* 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 org.apache.maven.model.Activation;
|
||||
|
||||
public class AlwaysOnActivation
|
||||
extends Activation
|
||||
{
|
||||
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package org.apache.maven.profiles.activation;
|
||||
|
||||
/*
|
||||
* 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 org.apache.maven.model.Profile;
|
||||
import org.apache.maven.profiles.AlwaysOnActivation;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
|
||||
@Component(role = ProfileActivator.class, hint = "always-on")
|
||||
public class AlwaysOnProfileActivator
|
||||
implements ProfileActivator
|
||||
{
|
||||
public boolean canDetermineActivation( Profile profile, ProfileActivationContext context )
|
||||
{
|
||||
return ( profile.getActivation() != null ) && ( profile.getActivation() instanceof AlwaysOnActivation );
|
||||
}
|
||||
|
||||
public boolean isActive( Profile profile, ProfileActivationContext context )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,154 +0,0 @@
|
|||
package org.apache.maven.profiles.activation;
|
||||
|
||||
/*
|
||||
* 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 org.apache.maven.model.Activation;
|
||||
//import org.apache.maven.model.ActivationCustom;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.codehaus.plexus.PlexusConstants;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
import org.codehaus.plexus.component.configurator.BasicComponentConfigurator;
|
||||
import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
|
||||
import org.codehaus.plexus.component.configurator.ComponentConfigurator;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
import org.codehaus.plexus.configuration.PlexusConfiguration;
|
||||
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
|
||||
import org.codehaus.plexus.context.Context;
|
||||
import org.codehaus.plexus.context.ContextException;
|
||||
import org.codehaus.plexus.logging.LogEnabled;
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
import org.codehaus.plexus.logging.console.ConsoleLogger;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
/**
|
||||
* Profile activator that allows the use of custom third-party activators, by specifying a type -
|
||||
* or role-hint - for the activator, along with a configuration (in the form of a DOM) to be used
|
||||
* in configuring the activator. This activator will lookup/configure custom activators on-the-fly,
|
||||
* without caching any of the lookups from the container.
|
||||
*/
|
||||
@Component(role = ProfileActivator.class, hint = "custom")
|
||||
public class CustomActivator
|
||||
implements ProfileActivator, LogEnabled
|
||||
{
|
||||
@Requirement
|
||||
private PlexusContainer container;
|
||||
|
||||
private Logger logger;
|
||||
|
||||
public boolean canDetermineActivation( Profile profile, ProfileActivationContext context )
|
||||
throws ProfileActivationException
|
||||
{
|
||||
/*
|
||||
Activation activation = profile.getActivation();
|
||||
|
||||
if ( activation != null )
|
||||
{
|
||||
ActivationCustom custom = activation.getCustom();
|
||||
|
||||
if ( custom != null )
|
||||
{
|
||||
ProfileActivator activator = loadProfileActivator( custom, context );
|
||||
|
||||
if ( activator != null )
|
||||
{
|
||||
return activator.canDetermineActivation( profile, context );
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
private ProfileActivator loadProfileActivator( ActivationCustom custom, ProfileActivationContext context )
|
||||
throws ProfileActivationException
|
||||
{
|
||||
String type = custom.getType();
|
||||
|
||||
ProfileActivator activator = null;
|
||||
|
||||
try
|
||||
{
|
||||
activator = container.lookup( ProfileActivator.class, type );
|
||||
}
|
||||
catch ( ComponentLookupException e )
|
||||
{
|
||||
if ( !context.isCustomActivatorFailureSuppressed() )
|
||||
{
|
||||
throw new ProfileActivationException(
|
||||
"Cannot find custom ProfileActivator: " + type + ". \nPerhaps you're missing a build extension?",
|
||||
e );
|
||||
}
|
||||
}
|
||||
|
||||
PlexusConfiguration configuration = new XmlPlexusConfiguration( (Xpp3Dom) custom.getConfiguration() );
|
||||
|
||||
ComponentConfigurator configurator = new BasicComponentConfigurator();
|
||||
|
||||
try
|
||||
{
|
||||
configurator.configureComponent( activator, configuration, container.getContainerRealm() );
|
||||
}
|
||||
catch ( ComponentConfigurationException e )
|
||||
{
|
||||
if ( !context.isCustomActivatorFailureSuppressed() )
|
||||
{
|
||||
throw new ProfileActivationException( "Failed to configure custom ProfileActivator: " + type + ".", e );
|
||||
}
|
||||
}
|
||||
|
||||
return activator;
|
||||
}
|
||||
*/
|
||||
|
||||
public boolean isActive( Profile profile, ProfileActivationContext context )
|
||||
throws ProfileActivationException
|
||||
{
|
||||
/*
|
||||
ActivationCustom custom = profile.getActivation().getCustom();
|
||||
|
||||
ProfileActivator activator = loadProfileActivator( custom, context );
|
||||
|
||||
return activator.isActive( profile, context );
|
||||
*/
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected Logger getLogger()
|
||||
{
|
||||
if ( logger == null )
|
||||
{
|
||||
logger = new ConsoleLogger( Logger.LEVEL_DEBUG, "CustomActivator-instantiated" );
|
||||
}
|
||||
|
||||
return logger;
|
||||
}
|
||||
|
||||
public void enableLogging( Logger logger )
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package org.apache.maven.profiles.activation;
|
||||
|
||||
/*
|
||||
* 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 org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
|
||||
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class CustomActivatorExpressionEvaluator
|
||||
implements ExpressionEvaluator
|
||||
{
|
||||
|
||||
public File alignToBaseDirectory( File file )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object evaluate( String expression )
|
||||
throws ExpressionEvaluationException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package org.apache.maven.profiles.activation;
|
||||
|
||||
/*
|
||||
* 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 org.apache.maven.model.Profile;
|
||||
import org.codehaus.plexus.logging.LogEnabled;
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
import org.codehaus.plexus.logging.console.ConsoleLogger;
|
||||
|
||||
public abstract class DetectedProfileActivator
|
||||
implements ProfileActivator, LogEnabled
|
||||
{
|
||||
private Logger logger;
|
||||
|
||||
public boolean canDetermineActivation( Profile profile, ProfileActivationContext context )
|
||||
{
|
||||
return canDetectActivation( profile, context );
|
||||
}
|
||||
|
||||
protected Logger getLogger()
|
||||
{
|
||||
if ( logger == null )
|
||||
{
|
||||
logger = new ConsoleLogger( Logger.LEVEL_DEBUG, "DetectedProfileActivator:internal" );
|
||||
}
|
||||
|
||||
return logger;
|
||||
}
|
||||
|
||||
public void enableLogging( Logger logger )
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
protected abstract boolean canDetectActivation( Profile profile, ProfileActivationContext context );
|
||||
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package org.apache.maven.profiles.activation;
|
||||
|
||||
/*
|
||||
* 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 org.apache.maven.model.Profile;
|
||||
|
||||
public interface ProfileActivator
|
||||
{
|
||||
static final String ROLE = ProfileActivator.class.getName();
|
||||
|
||||
boolean canDetermineActivation( Profile profile, ProfileActivationContext context )
|
||||
throws ProfileActivationException;
|
||||
|
||||
boolean isActive( Profile profile, ProfileActivationContext context )
|
||||
throws ProfileActivationException;
|
||||
|
||||
}
|
|
@ -30,7 +30,6 @@ import org.apache.maven.model.ReportPlugin;
|
|||
import org.apache.maven.model.Reporting;
|
||||
import org.apache.maven.model.Repository;
|
||||
import org.apache.maven.model.Resource;
|
||||
import org.apache.maven.profiles.activation.ProfileActivator;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
|
|
Loading…
Reference in New Issue