mirror of https://github.com/apache/maven.git
Adding more unit tests for error reporting. Almost done with project-based errors now.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@612333 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
47b1dda978
commit
1c235317d7
|
@ -0,0 +1,38 @@
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.apache.maven.errortest</groupId>
|
||||||
|
<artifactId>testReportActivatorLookupError-ext</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.3.1</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
|
<version>2.3</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-install-plugin</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>2.1</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>2.0.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -0,0 +1,13 @@
|
||||||
|
package org.ext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hello world!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class App
|
||||||
|
{
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
System.out.println( "Hello World!" );
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<component-set>
|
||||||
|
<components>
|
||||||
|
<component>
|
||||||
|
<role>org.apache.maven.profiles.activation.ProfileActivator</role>
|
||||||
|
<role-hint>faulty</role-hint>
|
||||||
|
<implementation>org.ext.App</implementation>
|
||||||
|
<requirements>
|
||||||
|
<requirement>
|
||||||
|
<role>org.apache.maven.artifact.ArtifactResolver</role>
|
||||||
|
<field-name>artifactResolver</field-name>
|
||||||
|
</requirement>
|
||||||
|
</requirements>
|
||||||
|
</component>
|
||||||
|
</components>
|
||||||
|
</component-set>
|
|
@ -0,0 +1,46 @@
|
||||||
|
<!--
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.apache.maven.errortest</groupId>
|
||||||
|
<artifactId>testReportActivatorLookupError</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>test-profile</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>java.version</name>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<extensions>
|
||||||
|
<extension>
|
||||||
|
<groupId>org.apache.maven.errortest</groupId>
|
||||||
|
<artifactId>testReportActivatorLookupError-ext</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
</extension>
|
||||||
|
</extensions>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -754,11 +754,17 @@ public class ErrorReporterPointcutTest
|
||||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
|
||||||
.setShowErrors( true )
|
.setShowErrors( true )
|
||||||
.setErrorReporter( reporter )
|
.setErrorReporter( reporter )
|
||||||
|
// .setErrorReporter( new DummyCoreErrorReporter() )
|
||||||
.setGoals( Arrays.asList( new String[] {
|
.setGoals( Arrays.asList( new String[] {
|
||||||
"initialize"
|
"initialize"
|
||||||
} ) );
|
} ) );
|
||||||
|
|
||||||
maven.execute( request );
|
MavenExecutionResult result = maven.execute( request );
|
||||||
|
|
||||||
|
// if ( result.hasExceptions() )
|
||||||
|
// {
|
||||||
|
// reportExceptions( result, projectDir );
|
||||||
|
// }
|
||||||
|
|
||||||
reporterCtl.verify();
|
reporterCtl.verify();
|
||||||
}
|
}
|
||||||
|
@ -766,33 +772,39 @@ public class ErrorReporterPointcutTest
|
||||||
public void testReportActivatorLookupError()
|
public void testReportActivatorLookupError()
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
// if ( !checkOnline() )
|
if ( !checkOnline() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
File projectDir = prepareProjectDir();
|
||||||
|
|
||||||
|
buildTestAccessory( new File( projectDir, "ext" ) );
|
||||||
|
|
||||||
|
File project = new File( projectDir, "project" );
|
||||||
|
|
||||||
|
reporter.reportActivatorLookupError( null, null, null, null, null );
|
||||||
|
reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
|
||||||
|
reporterCtl.setVoidCallable();
|
||||||
|
|
||||||
|
reporterCtl.replay();
|
||||||
|
|
||||||
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
|
||||||
|
.setShowErrors( true )
|
||||||
|
.setErrorReporter( reporter )
|
||||||
|
// .setErrorReporter( new DummyCoreErrorReporter() )
|
||||||
|
.setGoals( Arrays.asList( new String[] {
|
||||||
|
"initialize"
|
||||||
|
} ) );
|
||||||
|
|
||||||
|
MavenExecutionResult result = maven.execute( request );
|
||||||
|
|
||||||
|
// if ( result.hasExceptions() )
|
||||||
// {
|
// {
|
||||||
// return;
|
// reportExceptions( result, project );
|
||||||
// }
|
// }
|
||||||
//
|
|
||||||
// File projectDir = prepareProjectDir();
|
reporterCtl.verify();
|
||||||
//
|
|
||||||
// buildTestAccessory( new File( projectDir, "ext" ) );
|
|
||||||
//
|
|
||||||
// File project = new File( projectDir, "project" );
|
|
||||||
//
|
|
||||||
// reporter.reportActivatorLookupError( null, null, null, null );
|
|
||||||
// reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
|
|
||||||
// reporterCtl.setVoidCallable();
|
|
||||||
//
|
|
||||||
// reporterCtl.replay();
|
|
||||||
//
|
|
||||||
// MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
|
|
||||||
// .setShowErrors( true )
|
|
||||||
// .setErrorReporter( reporter )
|
|
||||||
// .setGoals( Arrays.asList( new String[] {
|
|
||||||
// "initialize"
|
|
||||||
// } ) );
|
|
||||||
//
|
|
||||||
// maven.execute( request );
|
|
||||||
//
|
|
||||||
// reporterCtl.verify();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReportBadDependencyVersion()
|
public void testReportBadDependencyVersion()
|
||||||
|
|
|
@ -8,8 +8,10 @@ import org.apache.maven.model.Repository;
|
||||||
import org.apache.maven.profiles.activation.ProfileActivationContext;
|
import org.apache.maven.profiles.activation.ProfileActivationContext;
|
||||||
import org.apache.maven.profiles.activation.ProfileActivationException;
|
import org.apache.maven.profiles.activation.ProfileActivationException;
|
||||||
import org.apache.maven.profiles.build.DefaultProfileAdvisor;
|
import org.apache.maven.profiles.build.DefaultProfileAdvisor;
|
||||||
|
import org.apache.maven.profiles.build.ProfileAdvisor;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
import org.apache.maven.profiles.DefaultProfileManager;
|
import org.apache.maven.profiles.DefaultProfileManager;
|
||||||
|
import org.apache.maven.profiles.ProfileManager;
|
||||||
import org.apache.maven.profiles.MavenProfilesBuilder;
|
import org.apache.maven.profiles.MavenProfilesBuilder;
|
||||||
import org.apache.maven.profiles.ProfilesRoot;
|
import org.apache.maven.profiles.ProfilesRoot;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
|
@ -32,29 +34,19 @@ public privileged aspect ProfileErrorReporterAspect
|
||||||
extends AbstractProjectErrorReporterAspect
|
extends AbstractProjectErrorReporterAspect
|
||||||
{
|
{
|
||||||
|
|
||||||
protected pointcut componentLookupException( ComponentLookupException cause ):
|
private pointcut within_pMgr_isActiveExec( Profile profile, ProfileActivationContext context ):
|
||||||
handler( ComponentLookupException )
|
withincode( boolean DefaultProfileManager.isActive( Profile, ProfileActivationContext ) )
|
||||||
&& args( cause )
|
&& args( profile, context );
|
||||||
&& notWithinAspect();
|
|
||||||
|
|
||||||
private pointcut pMgr_isActiveExec( Profile profile, ProfileActivationContext context ):
|
private pointcut pMgr_isActiveExec( Profile profile, ProfileActivationContext context ):
|
||||||
execution( boolean DefaultProfileManager.isActive( Profile, ProfileActivationContext ) )
|
execution( boolean DefaultProfileManager.isActive( Profile, ProfileActivationContext ) )
|
||||||
&& args( profile, context )
|
&& args( profile, context );
|
||||||
&& notWithinAspect();
|
|
||||||
|
|
||||||
private pointcut pAdv_applyActivatedProfiles( Model model, File pomFile ):
|
private pointcut pAdv_applyActivatedProfiles( Model model, File pomFile ):
|
||||||
execution( private List DefaultProfileAdvisor.applyActivatedProfiles( Model, File, .. ) )
|
execution( private List DefaultProfileAdvisor.applyActivatedProfiles( Model, File, .. ) )
|
||||||
&& args( model, pomFile, .. )
|
&& args( model, pomFile, .. )
|
||||||
&& notWithinAspect();
|
&& notWithinAspect();
|
||||||
|
|
||||||
private pointcut applyActivatedProfiles_ComponentLookupException( Model model,
|
|
||||||
File pomFile,
|
|
||||||
Profile profile ):
|
|
||||||
call( List PlexusContainer+.lookupList( .. ) )
|
|
||||||
&& cflow( pAdv_applyActivatedProfiles( model, pomFile ) )
|
|
||||||
&& cflow( pMgr_isActiveExec( profile, ProfileActivationContext ) )
|
|
||||||
&& notWithinAspect();
|
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// Call Stack:
|
// Call Stack:
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
@ -68,27 +60,48 @@ public privileged aspect ProfileErrorReporterAspect
|
||||||
// <-- ProfileActivationException
|
// <-- ProfileActivationException
|
||||||
// <------ ProjectBuildingException
|
// <------ ProjectBuildingException
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
after( Model model, File pomFile, Profile profile )
|
after( Model model, File pomFile, Profile profile, ProfileActivationContext context )
|
||||||
throwing( ComponentLookupException cause ):
|
throwing( ComponentLookupException cause ):
|
||||||
applyActivatedProfiles_ComponentLookupException( model, pomFile, profile )
|
call( List PlexusContainer+.lookupList( .. ) )
|
||||||
|
&& cflow( pAdv_applyActivatedProfiles( model, pomFile ) )
|
||||||
|
&& cflow( pMgr_isActiveExec( profile, context ) )
|
||||||
{
|
{
|
||||||
getReporter().reportActivatorLookupError( model.getId(), pomFile, profile, cause );
|
getReporter().reportActivatorLookupError( model, pomFile, profile, context, cause );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected pointcut profileActivatorCall( ProfileActivator activator ):
|
private pointcut pAdv_getArtifactRepositoriesFromActiveProfiles_1( Model model, File pomFile ):
|
||||||
call( * ProfileActivator+.*( .. ) )
|
execution( LinkedHashSet ProfileAdvisor+.getArtifactRepositoriesFromActiveProfiles( Model, File, ProfileManager ) )
|
||||||
&& target( activator )
|
&& args( model, pomFile, * );
|
||||||
&& notWithinAspect();
|
|
||||||
|
|
||||||
private pointcut applyActivatedProfiles_ActivatorThrown( ProfileActivator activator,
|
private pointcut pAdv_getArtifactRepositoriesFromActiveProfiles_2( Model model, File pomFile ):
|
||||||
Model model,
|
execution( LinkedHashSet ProfileAdvisor+.getArtifactRepositoriesFromActiveProfiles( Model, File, boolean, ProfileActivationContext ) )
|
||||||
File pomFile,
|
&& args( model, pomFile, *, * );
|
||||||
Profile profile,
|
|
||||||
ProfileActivationContext context ):
|
private pointcut pAdv_getArtifactRepos( Model model, File pomFile ):
|
||||||
profileActivatorCall( activator )
|
pAdv_getArtifactRepositoriesFromActiveProfiles_1( model, pomFile )
|
||||||
&& cflow( pAdv_applyActivatedProfiles( model, pomFile ) )
|
|| pAdv_getArtifactRepositoriesFromActiveProfiles_2( model, pomFile );
|
||||||
&& cflow( pMgr_isActiveExec( profile, context ) )
|
|
||||||
&& notWithinAspect();
|
// =========================================================================
|
||||||
|
// Call Stack:
|
||||||
|
// =========================================================================
|
||||||
|
// DefaultProfileAdvisor.applyActivatedProfiles(..)
|
||||||
|
// DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
|
||||||
|
// --> DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
|
||||||
|
// --> DefaultProfileManager.getActiveProfiles(..)
|
||||||
|
// --> DefaultProfileManager.isActive(..) (private)
|
||||||
|
// --> PlexusContainer.lookupList(..)
|
||||||
|
// <-- ComponentLookupException
|
||||||
|
// <-- ProfileActivationException
|
||||||
|
// <------ ProjectBuildingException
|
||||||
|
// =========================================================================
|
||||||
|
after( Model model, File pomFile, Profile profile, ProfileActivationContext context )
|
||||||
|
throwing( ComponentLookupException cause ):
|
||||||
|
call( List PlexusContainer+.lookupList( .. ) )
|
||||||
|
&& cflow( pAdv_getArtifactRepos( model, pomFile ) )
|
||||||
|
&& cflow( pMgr_isActiveExec( profile, context ) )
|
||||||
|
{
|
||||||
|
getReporter().reportActivatorLookupError( model, pomFile, profile, context, cause );
|
||||||
|
}
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// Call Stack:
|
// Call Stack:
|
||||||
|
@ -105,9 +118,12 @@ public privileged aspect ProfileErrorReporterAspect
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
after( ProfileActivator activator, Model model, File pomFile, Profile profile, ProfileActivationContext context )
|
after( ProfileActivator activator, Model model, File pomFile, Profile profile, ProfileActivationContext context )
|
||||||
throwing( ProfileActivationException cause ):
|
throwing( ProfileActivationException cause ):
|
||||||
applyActivatedProfiles_ActivatorThrown( activator, model, pomFile, profile, context )
|
call( * ProfileActivator+.*( .. ) )
|
||||||
|
&& target( activator )
|
||||||
|
&& cflow( pAdv_applyActivatedProfiles( model, pomFile ) )
|
||||||
|
&& cflow( pMgr_isActiveExec( profile, context ) )
|
||||||
{
|
{
|
||||||
getReporter().reportActivatorError( activator, model.getId(), pomFile, profile, context, cause );
|
getReporter().reportActivatorError( activator, model, pomFile, profile, context, cause );
|
||||||
}
|
}
|
||||||
|
|
||||||
private pointcut pAdv_loadExternalProjectProfiles( Model model, File pomFile ):
|
private pointcut pAdv_loadExternalProjectProfiles( Model model, File pomFile ):
|
||||||
|
@ -115,14 +131,6 @@ public privileged aspect ProfileErrorReporterAspect
|
||||||
&& args( *, model, pomFile )
|
&& args( *, model, pomFile )
|
||||||
&& notWithinAspect();
|
&& notWithinAspect();
|
||||||
|
|
||||||
private pointcut loadExternalProfiles_profileBuilding( Model model,
|
|
||||||
File pomFile,
|
|
||||||
File projectDir ):
|
|
||||||
call( ProfilesRoot MavenProfilesBuilder+.buildProfiles( File ) )
|
|
||||||
&& cflow( pAdv_loadExternalProjectProfiles( model, pomFile ) )
|
|
||||||
&& args( projectDir )
|
|
||||||
&& notWithinAspect();
|
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// Call Stack:
|
// Call Stack:
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
@ -136,7 +144,9 @@ public privileged aspect ProfileErrorReporterAspect
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
after( Model model, File pomFile, File projectDir )
|
after( Model model, File pomFile, File projectDir )
|
||||||
throwing( IOException cause ):
|
throwing( IOException cause ):
|
||||||
loadExternalProfiles_profileBuilding( model, pomFile, projectDir )
|
call( ProfilesRoot MavenProfilesBuilder+.buildProfiles( File ) )
|
||||||
|
&& cflow( pAdv_loadExternalProjectProfiles( model, pomFile ) )
|
||||||
|
&& args( projectDir )
|
||||||
{
|
{
|
||||||
getReporter().reportErrorLoadingExternalProfilesFromFile( model, pomFile, projectDir, cause );
|
getReporter().reportErrorLoadingExternalProfilesFromFile( model, pomFile, projectDir, cause );
|
||||||
}
|
}
|
||||||
|
@ -154,7 +164,9 @@ public privileged aspect ProfileErrorReporterAspect
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
after( Model model, File pomFile, File projectDir )
|
after( Model model, File pomFile, File projectDir )
|
||||||
throwing( XmlPullParserException cause ):
|
throwing( XmlPullParserException cause ):
|
||||||
loadExternalProfiles_profileBuilding( model, pomFile, projectDir )
|
call( ProfilesRoot MavenProfilesBuilder+.buildProfiles( File ) )
|
||||||
|
&& cflow( pAdv_loadExternalProjectProfiles( model, pomFile ) )
|
||||||
|
&& args( projectDir )
|
||||||
{
|
{
|
||||||
getReporter().reportErrorLoadingExternalProfilesFromFile( model, pomFile, projectDir, cause );
|
getReporter().reportErrorLoadingExternalProfilesFromFile( model, pomFile, projectDir, cause );
|
||||||
}
|
}
|
||||||
|
@ -164,45 +176,6 @@ public privileged aspect ProfileErrorReporterAspect
|
||||||
&& args( *, pomFile, projectId )
|
&& args( *, pomFile, projectId )
|
||||||
&& notWithinAspect();
|
&& notWithinAspect();
|
||||||
|
|
||||||
private pointcut getArtifactRepositoriesFromActiveProfiles_ComponentLookupException( String projectId,
|
|
||||||
File pomFile,
|
|
||||||
Profile profile ):
|
|
||||||
call( List PlexusContainer+.lookupList( .. ) )
|
|
||||||
&& cflow( pAdv_getArtifactRepositoriesFromActiveProfiles( projectId, pomFile ) )
|
|
||||||
&& cflow( pMgr_isActiveExec( profile, ProfileActivationContext ) )
|
|
||||||
&& notWithinAspect();
|
|
||||||
|
|
||||||
// =========================================================================
|
|
||||||
// Call Stack:
|
|
||||||
// =========================================================================
|
|
||||||
// DefaultProfileAdvisor.applyActivatedProfiles(..)
|
|
||||||
// DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
|
|
||||||
// --> DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
|
|
||||||
// --> DefaultProfileManager.getActiveProfiles(..)
|
|
||||||
// --> DefaultProfileManager.isActive(..) (private)
|
|
||||||
// --> PlexusContainer.lookupList(..)
|
|
||||||
// <-- ComponentLookupException
|
|
||||||
// <-- ProfileActivationException
|
|
||||||
// <------ ProjectBuildingException
|
|
||||||
// =========================================================================
|
|
||||||
after( String projectId, File pomFile, Profile profile )
|
|
||||||
throwing( ComponentLookupException cause ):
|
|
||||||
getArtifactRepositoriesFromActiveProfiles_ComponentLookupException( projectId, pomFile, profile )
|
|
||||||
{
|
|
||||||
getReporter().reportActivatorLookupError( projectId, pomFile, profile, cause );
|
|
||||||
}
|
|
||||||
|
|
||||||
private pointcut getArtifactRepositoriesFromActiveProfiles_ActivatorThrown( ProfileActivator activator,
|
|
||||||
String projectId,
|
|
||||||
File pomFile,
|
|
||||||
Profile profile,
|
|
||||||
ProfileActivationContext context ):
|
|
||||||
profileActivatorCall( activator )
|
|
||||||
&& cflow( pAdv_getArtifactRepositoriesFromActiveProfiles( projectId, pomFile ) )
|
|
||||||
&& cflow( pMgr_isActiveExec( profile, context ) )
|
|
||||||
&& within( DefaultProfileManager )
|
|
||||||
&& notWithinAspect();
|
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// Call Stack:
|
// Call Stack:
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
@ -216,22 +189,17 @@ public privileged aspect ProfileErrorReporterAspect
|
||||||
// <------ ProfileActivationException
|
// <------ ProfileActivationException
|
||||||
// <------ ProjectBuildingException
|
// <------ ProjectBuildingException
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
after( ProfileActivator activator, String projectId, File pomFile, Profile profile, ProfileActivationContext context )
|
after( ProfileActivator activator, Model model, File pomFile, Profile profile, ProfileActivationContext context )
|
||||||
throwing( ProfileActivationException cause ):
|
throwing( ProfileActivationException cause ):
|
||||||
getArtifactRepositoriesFromActiveProfiles_ActivatorThrown( activator, projectId, pomFile, profile, context )
|
call( * ProfileActivator+.*( .. ) )
|
||||||
|
&& target( activator )
|
||||||
|
&& cflow( pAdv_getArtifactRepos( model, pomFile ) )
|
||||||
|
&& cflow( pMgr_isActiveExec( profile, context ) )
|
||||||
|
&& within( DefaultProfileManager )
|
||||||
{
|
{
|
||||||
getReporter().reportActivatorError( activator, projectId, pomFile, profile, context, cause );
|
getReporter().reportActivatorError( activator, model, pomFile, profile, context, cause );
|
||||||
}
|
}
|
||||||
|
|
||||||
private pointcut getArtifactRepositoriesFromActiveProfiles_InvalidRepository( Repository repo,
|
|
||||||
String projectId,
|
|
||||||
File pomFile ):
|
|
||||||
call( ArtifactRepository MavenTools+.buildArtifactRepository( Repository ) )
|
|
||||||
&& args( repo )
|
|
||||||
&& cflow( pAdv_getArtifactRepositoriesFromActiveProfiles( projectId, pomFile ) )
|
|
||||||
&& within( DefaultProfileAdvisor )
|
|
||||||
&& notWithinAspect();
|
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// Call Stack:
|
// Call Stack:
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
@ -242,11 +210,14 @@ public privileged aspect ProfileErrorReporterAspect
|
||||||
// <-- InvalidRepositoryException
|
// <-- InvalidRepositoryException
|
||||||
// <-- ProjectBuildingException
|
// <-- ProjectBuildingException
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
after( Repository repo, String projectId, File pomFile )
|
after( Repository repo, Model model, File pomFile )
|
||||||
throwing( InvalidRepositoryException cause ):
|
throwing( InvalidRepositoryException cause ):
|
||||||
getArtifactRepositoriesFromActiveProfiles_InvalidRepository( repo, projectId, pomFile )
|
call( ArtifactRepository MavenTools+.buildArtifactRepository( Repository ) )
|
||||||
|
&& args( repo )
|
||||||
|
&& cflow( pAdv_getArtifactRepos( model, pomFile ) )
|
||||||
|
&& within( DefaultProfileAdvisor )
|
||||||
{
|
{
|
||||||
getReporter().reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( repo, projectId, pomFile, cause );
|
getReporter().reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( repo, model, pomFile, cause );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,14 +20,17 @@ package org.apache.maven.profiles;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.model.Activation;
|
import org.apache.maven.model.Activation;
|
||||||
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
import org.apache.maven.profiles.activation.DefaultProfileActivationContext;
|
import org.apache.maven.profiles.activation.DefaultProfileActivationContext;
|
||||||
import org.apache.maven.profiles.activation.ProfileActivationContext;
|
import org.apache.maven.profiles.activation.ProfileActivationContext;
|
||||||
import org.apache.maven.profiles.activation.ProfileActivationException;
|
import org.apache.maven.profiles.activation.ProfileActivationException;
|
||||||
import org.apache.maven.profiles.activation.ProfileActivator;
|
import org.apache.maven.profiles.activation.ProfileActivator;
|
||||||
|
import org.apache.maven.project.ModelUtils;
|
||||||
import org.apache.maven.realm.DefaultMavenRealmManager;
|
import org.apache.maven.realm.DefaultMavenRealmManager;
|
||||||
import org.apache.maven.realm.MavenRealmManager;
|
import org.apache.maven.realm.MavenRealmManager;
|
||||||
import org.codehaus.plexus.PlexusContainer;
|
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.ComponentLifecycleException;
|
||||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
@ -167,68 +170,92 @@ public class DefaultProfileManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.apache.maven.profiles.ProfileManager#getActiveProfiles()
|
|
||||||
*/
|
|
||||||
public List getActiveProfiles()
|
public List getActiveProfiles()
|
||||||
throws ProfileActivationException
|
throws ProfileActivationException
|
||||||
{
|
{
|
||||||
List activeFromPom = new ArrayList();
|
return getActiveProfiles( null );
|
||||||
List activeExternal = new ArrayList();
|
}
|
||||||
|
|
||||||
for ( Iterator it = profilesById.entrySet().iterator(); it.hasNext(); )
|
public List getActiveProfiles( Model model )
|
||||||
|
throws ProfileActivationException
|
||||||
|
{
|
||||||
|
MavenRealmManager realmManager = profileActivationContext.getRealmManager();
|
||||||
|
|
||||||
|
ClassRealm projectRealm = null;
|
||||||
|
ClassRealm oldLookupRealm = null;
|
||||||
|
|
||||||
|
if ( ( model != null ) && ( realmManager != null ) )
|
||||||
{
|
{
|
||||||
Map.Entry entry = (Entry) it.next();
|
projectRealm = realmManager.getProjectRealm( ModelUtils.getGroupId( model ), model.getArtifactId(), ModelUtils.getVersion( model ) );
|
||||||
|
oldLookupRealm = container.setLookupRealm( projectRealm );
|
||||||
String profileId = (String) entry.getKey();
|
|
||||||
Profile profile = (Profile) entry.getValue();
|
|
||||||
|
|
||||||
boolean shouldAdd = false;
|
|
||||||
if ( profileActivationContext.isExplicitlyActive( profileId ) )
|
|
||||||
{
|
|
||||||
shouldAdd = true;
|
|
||||||
}
|
|
||||||
else if ( !profileActivationContext.isExplicitlyInactive( profileId ) && isActive( profile, profileActivationContext ) )
|
|
||||||
{
|
|
||||||
shouldAdd = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( shouldAdd )
|
|
||||||
{
|
|
||||||
if ( "pom".equals( profile.getSource() ) )
|
|
||||||
{
|
|
||||||
activeFromPom.add( profile );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeExternal.add( profile );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( activeFromPom.isEmpty() )
|
try
|
||||||
{
|
{
|
||||||
List defaultIds = profileActivationContext.getActiveByDefaultProfileIds();
|
List activeFromPom = new ArrayList();
|
||||||
|
List activeExternal = new ArrayList();
|
||||||
|
|
||||||
for ( Iterator it = defaultIds.iterator(); it.hasNext(); )
|
for ( Iterator it = profilesById.entrySet().iterator(); it.hasNext(); )
|
||||||
{
|
{
|
||||||
String profileId = (String) it.next();
|
Map.Entry entry = (Entry) it.next();
|
||||||
|
|
||||||
Profile profile = (Profile) profilesById.get( profileId );
|
String profileId = (String) entry.getKey();
|
||||||
|
Profile profile = (Profile) entry.getValue();
|
||||||
|
|
||||||
if ( profile != null )
|
boolean shouldAdd = false;
|
||||||
|
if ( profileActivationContext.isExplicitlyActive( profileId ) )
|
||||||
{
|
{
|
||||||
activeFromPom.add( profile );
|
shouldAdd = true;
|
||||||
|
}
|
||||||
|
else if ( !profileActivationContext.isExplicitlyInactive( profileId ) && isActive( profile, profileActivationContext ) )
|
||||||
|
{
|
||||||
|
shouldAdd = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( shouldAdd )
|
||||||
|
{
|
||||||
|
if ( "pom".equals( profile.getSource() ) )
|
||||||
|
{
|
||||||
|
activeFromPom.add( profile );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
activeExternal.add( profile );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( activeFromPom.isEmpty() )
|
||||||
|
{
|
||||||
|
List defaultIds = profileActivationContext.getActiveByDefaultProfileIds();
|
||||||
|
|
||||||
|
for ( Iterator it = defaultIds.iterator(); it.hasNext(); )
|
||||||
|
{
|
||||||
|
String profileId = (String) it.next();
|
||||||
|
|
||||||
|
Profile profile = (Profile) profilesById.get( profileId );
|
||||||
|
|
||||||
|
if ( profile != null )
|
||||||
|
{
|
||||||
|
activeFromPom.add( profile );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List allActive = new ArrayList( activeFromPom.size() + activeExternal.size() );
|
||||||
|
|
||||||
|
allActive.addAll( activeExternal );
|
||||||
|
allActive.addAll( activeFromPom );
|
||||||
|
|
||||||
|
return allActive;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if ( projectRealm != null )
|
||||||
|
{
|
||||||
|
container.setLookupRealm( oldLookupRealm );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List allActive = new ArrayList( activeFromPom.size() + activeExternal.size() );
|
|
||||||
|
|
||||||
allActive.addAll( activeExternal );
|
|
||||||
allActive.addAll( activeFromPom );
|
|
||||||
|
|
||||||
return allActive;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isActive( Profile profile, ProfileActivationContext context )
|
private boolean isActive( Profile profile, ProfileActivationContext context )
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.maven.profiles;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
import org.apache.maven.profiles.activation.ProfileActivationContext;
|
import org.apache.maven.profiles.activation.ProfileActivationContext;
|
||||||
import org.apache.maven.profiles.activation.ProfileActivationException;
|
import org.apache.maven.profiles.activation.ProfileActivationException;
|
||||||
|
@ -59,6 +60,9 @@ public interface ProfileManager
|
||||||
|
|
||||||
void setProfileActivationContext( ProfileActivationContext profileActivationContext );
|
void setProfileActivationContext( ProfileActivationContext profileActivationContext );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link ProfileManager#getActiveProfiles(Model)} instead.
|
||||||
|
*/
|
||||||
List getActiveProfiles()
|
List getActiveProfiles()
|
||||||
throws ProfileActivationException;
|
throws ProfileActivationException;
|
||||||
|
|
||||||
|
@ -80,4 +84,7 @@ public interface ProfileManager
|
||||||
* @deprecated Use {@link ProfileActivationContext} methods instead.
|
* @deprecated Use {@link ProfileActivationContext} methods instead.
|
||||||
*/
|
*/
|
||||||
List getIdsActivatedByDefault();
|
List getIdsActivatedByDefault();
|
||||||
|
|
||||||
|
List getActiveProfiles( Model model )
|
||||||
|
throws ProfileActivationException;
|
||||||
}
|
}
|
|
@ -110,7 +110,7 @@ public class DefaultProfileAdvisor
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
activeProfiles = profileManager.getActiveProfiles();
|
activeProfiles = profileManager.getActiveProfiles( model );
|
||||||
}
|
}
|
||||||
catch ( ProfileActivationException e )
|
catch ( ProfileActivationException e )
|
||||||
{
|
{
|
||||||
|
@ -164,9 +164,9 @@ public class DefaultProfileAdvisor
|
||||||
return profileManager;
|
return profileManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedHashSet getArtifactRepositoriesFromActiveProfiles( ProfileManager profileManager,
|
public LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model,
|
||||||
File pomFile,
|
File pomFile,
|
||||||
String modelId )
|
ProfileManager profileManager )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -179,12 +179,12 @@ public class DefaultProfileAdvisor
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
activeExternalProfiles = profileManager.getActiveProfiles();
|
activeExternalProfiles = profileManager.getActiveProfiles( model );
|
||||||
}
|
}
|
||||||
catch ( ProfileActivationException e )
|
catch ( ProfileActivationException e )
|
||||||
{
|
{
|
||||||
throw new ProjectBuildingException(
|
throw new ProjectBuildingException(
|
||||||
modelId,
|
model.getId(),
|
||||||
"Failed to compute active profiles for repository aggregation.",
|
"Failed to compute active profiles for repository aggregation.",
|
||||||
pomFile, e );
|
pomFile, e );
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ public class DefaultProfileAdvisor
|
||||||
}
|
}
|
||||||
catch ( InvalidRepositoryException e )
|
catch ( InvalidRepositoryException e )
|
||||||
{
|
{
|
||||||
throw new ProjectBuildingException( modelId, e.getMessage(), e );
|
throw new ProjectBuildingException( model.getId(), e.getMessage(), e );
|
||||||
}
|
}
|
||||||
|
|
||||||
remoteRepositories.add( artifactRepo );
|
remoteRepositories.add( artifactRepo );
|
||||||
|
@ -230,7 +230,7 @@ public class DefaultProfileAdvisor
|
||||||
useProfilesXml,
|
useProfilesXml,
|
||||||
activationContext );
|
activationContext );
|
||||||
|
|
||||||
return getArtifactRepositoriesFromActiveProfiles( profileManager, pomFile, model.getId() );
|
return getArtifactRepositoriesFromActiveProfiles( model, pomFile, profileManager );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadExternalProjectProfiles( ProfileManager profileManager,
|
private void loadExternalProjectProfiles( ProfileManager profileManager,
|
||||||
|
|
|
@ -38,9 +38,9 @@ public interface ProfileAdvisor
|
||||||
|
|
||||||
String ROLE = ProfileAdvisor.class.getName();
|
String ROLE = ProfileAdvisor.class.getName();
|
||||||
|
|
||||||
LinkedHashSet getArtifactRepositoriesFromActiveProfiles( ProfileManager profileManager,
|
LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model,
|
||||||
File pomFile,
|
File pomFile,
|
||||||
String modelId )
|
ProfileManager profileManager )
|
||||||
throws ProjectBuildingException;
|
throws ProjectBuildingException;
|
||||||
|
|
||||||
LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model,
|
LinkedHashSet getArtifactRepositoriesFromActiveProfiles( Model model,
|
||||||
|
|
|
@ -225,14 +225,20 @@ public class DefaultMavenProjectBuilder
|
||||||
|
|
||||||
superModel = ModelUtils.cloneModel( superModel );
|
superModel = ModelUtils.cloneModel( superModel );
|
||||||
|
|
||||||
List activeProfiles;
|
List activeProfiles = new ArrayList();
|
||||||
if ( profileManager != null )
|
if ( profileManager != null )
|
||||||
{
|
{
|
||||||
activeProfiles = profileAdvisor.applyActivatedExternalProfiles( superModel, null, profileManager );
|
List activated = profileAdvisor.applyActivatedProfiles( superModel, null, false, profileManager.getProfileActivationContext() );
|
||||||
}
|
if ( !activated.isEmpty() )
|
||||||
else
|
{
|
||||||
{
|
activeProfiles.addAll( activated );
|
||||||
activeProfiles = Collections.EMPTY_LIST;
|
}
|
||||||
|
|
||||||
|
activated = profileAdvisor.applyActivatedExternalProfiles( superModel, null, profileManager );
|
||||||
|
if ( !activated.isEmpty() )
|
||||||
|
{
|
||||||
|
activeProfiles.addAll( activated );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MavenProject project = new MavenProject( superModel );
|
MavenProject project = new MavenProject( superModel );
|
||||||
|
@ -593,13 +599,13 @@ public class DefaultMavenProjectBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedHashSet activeInSuperPom = new LinkedHashSet();
|
LinkedHashSet activeInSuperPom = new LinkedHashSet();
|
||||||
List activated = profileAdvisor.applyActivatedExternalProfiles( superModel, projectDescriptor, externalProfileManager );
|
List activated = profileAdvisor.applyActivatedProfiles( superModel, projectDescriptor, validProfilesXmlLocation, profileActivationContext );
|
||||||
if ( !activated.isEmpty() )
|
if ( !activated.isEmpty() )
|
||||||
{
|
{
|
||||||
activeInSuperPom.addAll( activated );
|
activeInSuperPom.addAll( activated );
|
||||||
}
|
}
|
||||||
|
|
||||||
activated = profileAdvisor.applyActivatedProfiles( superModel, projectDescriptor, validProfilesXmlLocation, profileActivationContext );
|
activated = profileAdvisor.applyActivatedExternalProfiles( superModel, projectDescriptor, externalProfileManager );
|
||||||
if ( !activated.isEmpty() )
|
if ( !activated.isEmpty() )
|
||||||
{
|
{
|
||||||
activeInSuperPom.addAll( activated );
|
activeInSuperPom.addAll( activated );
|
||||||
|
|
|
@ -1121,4 +1121,30 @@ public final class ModelUtils
|
||||||
return new ArrayList( depsMap.values() );
|
return new ArrayList( depsMap.values() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getGroupId( Model model )
|
||||||
|
{
|
||||||
|
Parent parent = model.getParent();
|
||||||
|
|
||||||
|
String groupId = model.getGroupId();
|
||||||
|
if ( ( parent != null ) && ( groupId == null ) )
|
||||||
|
{
|
||||||
|
groupId = parent.getGroupId();
|
||||||
|
}
|
||||||
|
|
||||||
|
return groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getVersion( Model model )
|
||||||
|
{
|
||||||
|
Parent parent = model.getParent();
|
||||||
|
|
||||||
|
String version = model.getVersion();
|
||||||
|
if ( ( parent != null ) && ( version == null ) )
|
||||||
|
{
|
||||||
|
version = parent.getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,9 +291,9 @@ public class DefaultModelLineageBuilder
|
||||||
context = new DefaultProfileActivationContext( System.getProperties(), false );
|
context = new DefaultProfileActivationContext( System.getProperties(), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedHashSet profileRepos = profileAdvisor.getArtifactRepositoriesFromActiveProfiles( profileManager,
|
LinkedHashSet profileRepos = profileAdvisor.getArtifactRepositoriesFromActiveProfiles( model,
|
||||||
pomFile,
|
pomFile,
|
||||||
model.getId() );
|
profileManager );
|
||||||
|
|
||||||
getLogger().debug( "Got external-profile repositories: " + profileRepos );
|
getLogger().debug( "Got external-profile repositories: " + profileRepos );
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class DefaultProjectErrorReporter
|
||||||
* @see org.apache.maven.project.error.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)
|
* @see org.apache.maven.project.error.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,
|
public void reportActivatorError( ProfileActivator activator,
|
||||||
String projectId,
|
Model model,
|
||||||
File pomFile,
|
File pomFile,
|
||||||
Profile profile,
|
Profile profile,
|
||||||
ProfileActivationContext context,
|
ProfileActivationContext context,
|
||||||
|
@ -139,9 +139,9 @@ public class DefaultProjectErrorReporter
|
||||||
writer.write( NEWLINE );
|
writer.write( NEWLINE );
|
||||||
writer.write( cause.getMessage() );
|
writer.write( cause.getMessage() );
|
||||||
|
|
||||||
addStandardInfo( projectId, pomFile, writer );
|
addStandardInfo( model.getId(), pomFile, writer );
|
||||||
addTips( ProjectErrorTips.getTipsForActivatorError( activator,
|
addTips( ProjectErrorTips.getTipsForActivatorError( activator,
|
||||||
projectId,
|
model.getId(),
|
||||||
pomFile,
|
pomFile,
|
||||||
profile,
|
profile,
|
||||||
context,
|
context,
|
||||||
|
@ -153,9 +153,10 @@ public class DefaultProjectErrorReporter
|
||||||
/**
|
/**
|
||||||
* @see org.apache.maven.project.error.ProjectErrorReporter#reportActivatorLookupError(java.lang.String, java.io.File, org.apache.maven.model.Profile, org.codehaus.plexus.component.repository.exception.ComponentLookupException)
|
* @see org.apache.maven.project.error.ProjectErrorReporter#reportActivatorLookupError(java.lang.String, java.io.File, org.apache.maven.model.Profile, org.codehaus.plexus.component.repository.exception.ComponentLookupException)
|
||||||
*/
|
*/
|
||||||
public void reportActivatorLookupError( String projectId,
|
public void reportActivatorLookupError( Model model,
|
||||||
File pomFile,
|
File pomFile,
|
||||||
Profile profile,
|
Profile profile,
|
||||||
|
ProfileActivationContext context,
|
||||||
ComponentLookupException cause )
|
ComponentLookupException cause )
|
||||||
{
|
{
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
|
@ -174,8 +175,8 @@ public class DefaultProjectErrorReporter
|
||||||
writer.write( NEWLINE );
|
writer.write( NEWLINE );
|
||||||
writer.write( cause.getMessage() );
|
writer.write( cause.getMessage() );
|
||||||
|
|
||||||
addStandardInfo( projectId, pomFile, writer );
|
addStandardInfo( model.getId(), pomFile, writer );
|
||||||
addTips( ProjectErrorTips.getTipsForActivatorLookupError( projectId,
|
addTips( ProjectErrorTips.getTipsForActivatorLookupError( model.getId(),
|
||||||
pomFile,
|
pomFile,
|
||||||
profile,
|
profile,
|
||||||
cause ), writer );
|
cause ), writer );
|
||||||
|
@ -252,7 +253,7 @@ public class DefaultProjectErrorReporter
|
||||||
* @see org.apache.maven.project.error.ProjectErrorReporter#reportInvalidRepositoryWhileGettingRepositoriesFromProfiles(org.apache.maven.model.Repository, java.lang.String, java.io.File, org.apache.maven.artifact.InvalidRepositoryException)
|
* @see org.apache.maven.project.error.ProjectErrorReporter#reportInvalidRepositoryWhileGettingRepositoriesFromProfiles(org.apache.maven.model.Repository, java.lang.String, java.io.File, org.apache.maven.artifact.InvalidRepositoryException)
|
||||||
*/
|
*/
|
||||||
public void reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( Repository repo,
|
public void reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( Repository repo,
|
||||||
String projectId,
|
Model model,
|
||||||
File pomFile,
|
File pomFile,
|
||||||
InvalidRepositoryException cause )
|
InvalidRepositoryException cause )
|
||||||
{
|
{
|
||||||
|
@ -271,8 +272,8 @@ public class DefaultProjectErrorReporter
|
||||||
writer.write( NEWLINE );
|
writer.write( NEWLINE );
|
||||||
writer.write( cause.getMessage() );
|
writer.write( cause.getMessage() );
|
||||||
|
|
||||||
addStandardInfo( projectId, pomFile, writer );
|
addStandardInfo( model.getId(), pomFile, writer );
|
||||||
addTips( ProjectErrorTips.getTipsForInvalidRepositorySpec( repo, projectId, pomFile, cause ),
|
addTips( ProjectErrorTips.getTipsForInvalidRepositorySpec( repo, model.getId(), pomFile, cause ),
|
||||||
writer );
|
writer );
|
||||||
|
|
||||||
registerBuildError( cause, writer.toString(), cause.getCause() );
|
registerBuildError( cause, writer.toString(), cause.getCause() );
|
||||||
|
|
|
@ -55,7 +55,7 @@ public interface ProjectErrorReporter
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
void reportActivatorError( ProfileActivator activator,
|
void reportActivatorError( ProfileActivator activator,
|
||||||
String projectId,
|
Model model,
|
||||||
File pomFile,
|
File pomFile,
|
||||||
Profile profile,
|
Profile profile,
|
||||||
ProfileActivationContext context,
|
ProfileActivationContext context,
|
||||||
|
@ -77,9 +77,10 @@ public interface ProjectErrorReporter
|
||||||
* <------ ProjectBuildingException
|
* <------ ProjectBuildingException
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
void reportActivatorLookupError( String projectId,
|
void reportActivatorLookupError( Model model,
|
||||||
File pomFile,
|
File pomFile,
|
||||||
Profile profile,
|
Profile profile,
|
||||||
|
ProfileActivationContext context,
|
||||||
ComponentLookupException cause );
|
ComponentLookupException cause );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,7 +132,7 @@ public interface ProjectErrorReporter
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
void reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( Repository repo,
|
void reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( Repository repo,
|
||||||
String projectId,
|
Model model,
|
||||||
File pomFile,
|
File pomFile,
|
||||||
InvalidRepositoryException cause );
|
InvalidRepositoryException cause );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue