Disable the pluginRepository deprecation message until the first release of 2.1 is imminent, to avoid confusion when using IDEs that use 2.1 snapshots (where the CLI still uses 2.0.x).

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@659236 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2008-05-22 20:15:52 +00:00
parent 9dd2e54583
commit e458d85616
1 changed files with 91 additions and 90 deletions

View File

@ -19,95 +19,96 @@ import java.util.Map;
public privileged aspect Maven20xProjectCompatAspect
{
private pointcut reactorProjectBuilds():
cflow( execution( * DefaultMavenProjectBuilder.buildFromSourceFileInternal( .. ) ) )
&& !cflow( execution( * MavenMetadataSource.*( .. ) ) );
private pointcut lineageBuildResumed( DefaultMavenProjectBuilder projectBuilder, ModelLineage lineage ):
call( * ModelLineageBuilder.resumeBuildingModelLineage( ModelLineage, .. ) )
&& this( projectBuilder )
&& args( lineage, .. );
after( DefaultMavenProjectBuilder projectBuilder, ModelLineage lineage ):
reactorProjectBuilds()
&& lineageBuildResumed( projectBuilder, lineage )
{
for ( ModelLineageIterator it = lineage.lineageIterator(); it.hasNext(); )
{
Model model = (Model) it.next();
List pluginRepos = model.getPluginRepositories();
if ( pluginRepos != null && !pluginRepos.isEmpty() )
{
StringBuffer message = new StringBuffer();
message.append( "The <pluginRepositories/> section of the POM has been deprecated. Please update your POM (" );
message.append( model.getId() );
message.append( ")." );
projectBuilder.logger.warn( message.toString() );
}
}
}
private pointcut externalProfilesApplied( DefaultProfileAdvisor advisor, ProfileManager profileManager ):
execution( * DefaultProfileAdvisor.applyActivatedExternalProfiles( .., ProfileManager+ ) )
&& this( advisor )
&& args( .., profileManager );
private boolean settingsProfilesChecked = false;
before( DefaultProfileAdvisor advisor, ProfileManager profileManager ):
reactorProjectBuilds()
&& externalProfilesApplied( advisor, profileManager )
{
if ( profileManager == null )
{
return;
}
Map profilesById = profileManager.getProfilesById();
Set invalidProfiles = new HashSet();
boolean settingsProfilesEncountered = false;
for ( Iterator it = profilesById.values().iterator(); it.hasNext(); )
{
Profile profile = (Profile) it.next();
if ( "settings.xml".equals( profile.getSource() ) )
{
settingsProfilesEncountered = true;
if ( settingsProfilesChecked )
{
continue;
}
}
List pluginRepos = profile.getPluginRepositories();
if ( pluginRepos != null && !pluginRepos.isEmpty() )
{
invalidProfiles.add( profile );
}
}
if ( !invalidProfiles.isEmpty() )
{
StringBuffer message = new StringBuffer();
message.append( "The <pluginRepositories/> section of the POM has been deprecated. Please update the following profiles:\n" );
for ( Iterator it = invalidProfiles.iterator(); it.hasNext(); )
{
Profile profile = (Profile) it.next();
message.append( "\n- " ).append( profile.getId() ).append( " (source: " ).append( profile.getSource() ).append( ")" );
}
message.append( "\n" );
advisor.logger.warn( message.toString() );
}
settingsProfilesChecked = settingsProfilesChecked || settingsProfilesEncountered;
}
// FIXME: Re-enable this when we're closer to a 2.1 release.
// private pointcut reactorProjectBuilds():
// cflow( execution( * DefaultMavenProjectBuilder.buildFromSourceFileInternal( .. ) ) )
// && !cflow( execution( * MavenMetadataSource.*( .. ) ) );
//
// private pointcut lineageBuildResumed( DefaultMavenProjectBuilder projectBuilder, ModelLineage lineage ):
// call( * ModelLineageBuilder.resumeBuildingModelLineage( ModelLineage, .. ) )
// && this( projectBuilder )
// && args( lineage, .. );
//
// after( DefaultMavenProjectBuilder projectBuilder, ModelLineage lineage ):
// reactorProjectBuilds()
// && lineageBuildResumed( projectBuilder, lineage )
// {
// for ( ModelLineageIterator it = lineage.lineageIterator(); it.hasNext(); )
// {
// Model model = (Model) it.next();
// List pluginRepos = model.getPluginRepositories();
//
// if ( pluginRepos != null && !pluginRepos.isEmpty() )
// {
// StringBuffer message = new StringBuffer();
// message.append( "The <pluginRepositories/> section of the POM has been deprecated. Please update your POM (" );
// message.append( model.getId() );
// message.append( ")." );
//
// projectBuilder.logger.warn( message.toString() );
// }
// }
// }
//
// private pointcut externalProfilesApplied( DefaultProfileAdvisor advisor, ProfileManager profileManager ):
// execution( * DefaultProfileAdvisor.applyActivatedExternalProfiles( .., ProfileManager+ ) )
// && this( advisor )
// && args( .., profileManager );
//
//
// private boolean settingsProfilesChecked = false;
//
// before( DefaultProfileAdvisor advisor, ProfileManager profileManager ):
// reactorProjectBuilds()
// && externalProfilesApplied( advisor, profileManager )
// {
// if ( profileManager == null )
// {
// return;
// }
//
// Map profilesById = profileManager.getProfilesById();
// Set invalidProfiles = new HashSet();
//
// boolean settingsProfilesEncountered = false;
// for ( Iterator it = profilesById.values().iterator(); it.hasNext(); )
// {
// Profile profile = (Profile) it.next();
//
// if ( "settings.xml".equals( profile.getSource() ) )
// {
// settingsProfilesEncountered = true;
//
// if ( settingsProfilesChecked )
// {
// continue;
// }
// }
//
// List pluginRepos = profile.getPluginRepositories();
// if ( pluginRepos != null && !pluginRepos.isEmpty() )
// {
// invalidProfiles.add( profile );
// }
// }
//
// if ( !invalidProfiles.isEmpty() )
// {
// StringBuffer message = new StringBuffer();
// message.append( "The <pluginRepositories/> section of the POM has been deprecated. Please update the following profiles:\n" );
//
// for ( Iterator it = invalidProfiles.iterator(); it.hasNext(); )
// {
// Profile profile = (Profile) it.next();
// message.append( "\n- " ).append( profile.getId() ).append( " (source: " ).append( profile.getSource() ).append( ")" );
// }
//
// message.append( "\n" );
//
// advisor.logger.warn( message.toString() );
// }
//
// settingsProfilesChecked = settingsProfilesChecked || settingsProfilesEncountered;
// }
}