maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r598748 [2/2] - in /maven/components/trunk: maven-embedder/ maven-embedder/src/main/aspect/org/apache/maven/embedder/cache/ maven-embedder/src/main/java/org/apache/maven/cli/ maven-embedder/src/test/java/org/apache/maven/cli/ maven-project/...
Date Tue, 27 Nov 2007 19:55:08 GMT
Added: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorReporter.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorReporter.java?rev=598748&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorReporter.java
(added)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorReporter.java
Tue Nov 27 11:55:04 2007
@@ -0,0 +1,307 @@
+package org.apache.maven.project.error;
+
+import org.apache.maven.artifact.InvalidRepositoryException;
+import org.apache.maven.artifact.UnknownRepositoryLayoutException;
+import org.apache.maven.model.DeploymentRepository;
+import org.apache.maven.model.Model;
+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.project.InvalidProjectModelException;
+import org.apache.maven.project.InvalidProjectVersionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+import org.apache.maven.project.interpolation.ModelInterpolationException;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.File;
+import java.io.IOException;
+
+public interface ProjectErrorReporter
+{
+
+    String NEWLINE = "\n";
+
+    void clearErrors();
+
+    String getFormattedMessage( Throwable error );
+
+    Throwable getRealCause( Throwable error );
+
+    Throwable findReportedException( Throwable error );
+
+    /**
+     * <b>Call Stack:</b>
+     * <br/>
+     * <pre>
+     * DefaultProfileAdvisor.applyActivatedProfiles(..)
+     * DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
+     * --&gt; DefaultProfileAdvisor.applyActivatedProfiles(..) (private)
+     *     --&gt; DefaultProfileManager.getActiveProfiles(..)
+     *         --&gt; DefaultProfileManager.isActive(..) (private)
+     *             --&gt; ProfileActivator.canDetermineActivation(..)
+     *             --&gt; ProfileActivator.isActive(..)
+     *         &lt;------ ProfileActivationException
+     * &lt;------ ProjectBuildingException
+     * </pre>
+     */
+    void reportActivatorErrorWhileApplyingProfiles( ProfileActivator activator,
+                                                    Model model,
+                                                    File pomFile,
+                                                    Profile profile,
+                                                    ProfileActivationContext context,
+                                                    ProfileActivationException cause );
+
+    /**
+     * <b>Call Stack:</b>
+     * <br/>
+     * <pre>
+     * DefaultProfileAdvisor.applyActivatedProfiles(..)
+     * DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
+     * --&gt; DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
+     *     --&gt; DefaultProfileManager.getActiveProfiles(..)
+     *         --&gt; DefaultProfileManager.isActive(..) (private)
+     *             --&gt; ProfileActivator.canDetermineActivation(..)
+     *             --&gt; ProfileActivator.isActive(..)
+     *         &lt;------ ProfileActivationException
+     * &lt;------ ProjectBuildingException
+     * </pre>
+     */
+    void reportActivatorErrorWhileGettingRepositoriesFromProfiles( ProfileActivator activator,
+                                                                   String projectId,
+                                                                   File pomFile,
+                                                                   Profile profile,
+                                                                   ProfileActivationContext
context,
+                                                                   ProfileActivationException
cause );
+
+    /**
+     * <b>Call Stack:</b>
+     * <br/>
+     * <pre>
+     * DefaultProfileAdvisor.applyActivatedProfiles(..)
+     * DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
+     * --&gt; DefaultProfileAdvisor.applyActivatedProfiles(..) (private)
+     *     --&gt; DefaultProfileManager.getActiveProfiles(..)
+     *         --&gt; DefaultProfileManager.isActive(..) (private)
+     *             --&gt; PlexusContainer.lookupList(..)
+     *             &lt;-- ComponentLookupException
+     *         &lt;-- ProfileActivationException
+     * &lt;------ ProjectBuildingException
+     * </pre>
+     */
+    void reportActivatorLookupErrorWhileApplyingProfiles( Model model,
+                                                          File pomFile,
+                                                          Profile profile,
+                                                          ComponentLookupException cause
);
+
+    /**
+     * <b>Call Stack:</b>
+     * <br/>
+     * <pre>
+     * DefaultProfileAdvisor.applyActivatedProfiles(..)
+     * DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
+     * --&gt; DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
+     *     --&gt; DefaultProfileManager.getActiveProfiles(..)
+     *         --&gt; DefaultProfileManager.isActive(..) (private)
+     *             --&gt; PlexusContainer.lookupList(..)
+     *             &lt;-- ComponentLookupException
+     *         &lt;-- ProfileActivationException
+     * &lt;------ ProjectBuildingException
+     * </pre>
+     */
+    void reportActivatorLookupErrorWhileGettingRepositoriesFromProfiles( String projectId,
+                                                                         File pomFile,
+                                                                         Profile profile,
+                                                                         ComponentLookupException
cause );
+
+    /**
+     * <b>Call Stack:</b>
+     * <br/>
+     * <pre>
+     * DefaultProfileAdvisor.applyActivatedProfiles(..)
+     * DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
+     * --&gt; DefaultProfileAdvisor.buildProfileManager(..) (private)
+     *     --&gt; DefaultProfileAdvisor.loadExternalProjectProfiles(..) (private)
+     *         --&gt; MavenProfilesBuilder.buildProfiles(..)
+     *         &lt;-- IOException
+     * &lt;------ ProjectBuildingException
+     * </pre>
+     */
+    void reportErrorLoadingExternalProfilesFromFile( Model model,
+                                                     File pomFile,
+                                                     File projectDir,
+                                                     IOException cause );
+
+    /**
+     * <b>Call Stack:</b>
+     * <br/>
+     * <pre>
+     * DefaultProfileAdvisor.applyActivatedProfiles(..)
+     * DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
+     * --&gt; DefaultProfileAdvisor.buildProfileManager(..) (private)
+     *     --&gt; DefaultProfileAdvisor.loadExternalProjectProfiles(..) (private)
+     *         --&gt; MavenProfilesBuilder.buildProfiles(..)
+     *         &lt;-- XmlPullParserException
+     * &lt;------ ProjectBuildingException
+     * </pre>
+     */
+    void reportErrorLoadingExternalProfilesFromFile( Model model,
+                                                     File pomFile,
+                                                     File projectDir,
+                                                     XmlPullParserException cause );
+
+    /**
+     * <b>Call Stack:</b>
+     * <br/>
+     * <pre>
+     * DefaultProfileAdvisor.applyActivatedProfiles(..)
+     * DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
+     * --&gt; DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
+     *     --&gt; MavenTools.buildArtifactRepository(..)
+     *     &lt;-- InvalidRepositoryException
+     * &lt;-- ProjectBuildingException
+     * </pre>
+     */
+    void reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( Repository repo,
+                                                                      String projectId,
+                                                                      File pomFile,
+                                                                      InvalidRepositoryException
cause );
+
+    /**
+     * <b>Call Stack:</b>
+     * <br/>
+     * <pre>
+     * ...
+     * --&gt; DefaultMavenProjectBuilder.buildFromRepository(..)
+     *  DefaultMavenProjectBuilder.build(..)
+     * --&gt; DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
+     *     --&gt; DefaultMavenProjectBuilder.buildInternal(..) (private)
+     *         --&gt; DefaultMavenProjectBuilder.processProjectLogic(..) (private)
+     *             --&gt; DefaultMavenTools.buildDeploymentArtifactRepository(..)
+     *             &lt;-- UnknownRepositoryLayoutException
+     * &lt;-------- ProjectBuildingException
+     * </pre>
+     */
+    void reportErrorCreatingDeploymentArtifactRepository( MavenProject project,
+                                                          File pomFile,
+                                                          DeploymentRepository repo,
+                                                          UnknownRepositoryLayoutException
cause );
+
+    /**
+     * <b>Call Stack:</b>
+     * <br/>
+     * <pre>
+     * ...
+     * --&gt; DefaultMavenProjectBuilder.buildFromRepository(..)
+     *  DefaultMavenProjectBuilder.build(..)
+     * --&gt; DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
+     *     --&gt; DefaultMavenProjectBuilder.buildInternal(..) (private)
+     *         --&gt; DefaultMavenProjectBuilder.processProjectLogic(..) (private)
+     *             --&gt; DefaultMavenTools.buildArtifactRepositories(..)
+     *                 --&gt; DefaultMavenTools.buildArtifactRepository(..)
+     *             &lt;------ UnknownRepositoryLayoutException
+     * &lt;---------- ProjectBuildingException
+     * </pre>
+     */
+    void reportErrorCreatingArtifactRepository( MavenProject project,
+                                                File pomFile,
+                                                Repository repo,
+                                                UnknownRepositoryLayoutException cause,
+                                                boolean isPluginRepo );
+
+    /**
+     * <b>Call Stack:</b>
+     * <br/>
+     * <pre>
+     * ...
+     * --&gt; DefaultMavenProjectBuilder.buildFromRepository(..)
+     *  DefaultMavenProjectBuilder.build(..)
+     * --&gt; DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
+     *     --&gt; DefaultMavenProjectBuilder.buildInternal(..) (private)
+     *         --&gt; DefaultMavenProjectBuilder.processProjectLogic(..) (private)
+     *             --&gt; ModelInterpolator.interpolate(..)
+     *             &lt;-- ModelInterpolationException
+     * &lt;---------- ProjectBuildingException
+     * </pre>
+     */
+    void reportErrorInterpolatingModel( MavenProject project,
+                                        File pomFile,
+                                        ModelInterpolationException cause );
+
+    /**
+     * <b>Call Stack:</b>
+     * <br/>
+     * <pre>
+     * ...
+     * --&gt; DefaultMavenProjectBuilder.buildFromRepository(..)
+     *  DefaultMavenProjectBuilder.build(..)
+     * --&gt; DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
+     *     --&gt; DefaultMavenProjectBuilder.buildInternal(..) (private)
+     *         --&gt; DefaultMavenProjectBuilder.processProjectLogic(..) (private)
+     *             --&gt; DefaultMavenProjectBuilder.createPluginArtifacts(..)
+     *             --&gt; DefaultMavenProjectBuilder.createReportArtifacts(..)
+     *             --&gt; DefaultMavenProjectBuilder.createExtensionArtifacts(..)
+     *             &lt;-- InvalidProjectVersionException
+     * &lt;---------- ProjectBuildingException
+     * </pre>
+     */
+    void reportBadNonDependencyProjectArtifactVersion( MavenProject project,
+                                                       File pomFile,
+                                                       InvalidProjectVersionException cause
);
+
+    /**
+     * <b>Call Stack:</b>
+     * <br/>
+     * <pre>
+     * ...
+     * --&gt; DefaultMavenProjectBuilder.buildFromRepository(..)
+     *  DefaultMavenProjectBuilder.build(..)
+     * --&gt; DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
+     *     --&gt; DefaultMavenProjectBuilder.buildInternal(..) (private)
+     *         --&gt; DefaultMavenProjectBuilder.processProjectLogic(..) (private)
+     *             --&gt; (model validator result)
+     *         &lt;-- InvalidProjectModelException
+     * &lt;---------- ProjectBuildingException
+     * </pre>
+     */
+    void reportProjectValidationFailure( MavenProject project,
+                                         File pomFile,
+                                         InvalidProjectModelException error );
+
+    /**
+     * <b>Call Stack:</b>
+     * <br/>
+     * <pre>
+     * ...
+     * --&gt; DefaultMavenProjectBuilder.buildFromRepository(..)
+     *  DefaultMavenProjectBuilder.build(..)
+     * --&gt; DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
+     *     --&gt; DefaultMavenProjectBuilder.buildInternal(..) (private)
+     *         --&gt; DefaultMavenProjectBuilder.createManagedVersionMap(..) (private)
+     *         &lt;-- InvalidDependencyVersionException
+     * &lt;---------- ProjectBuildingException
+     * </pre>
+     */
+    void reportBadManagedDependencyVersion( MavenProject projectBeingBuilt,
+                                     File pomFile,
+                                     InvalidDependencyVersionException cause );
+
+    /**
+     * <b>Call Stack:</b>
+     * <br/>
+     * <pre>
+     * ...
+     * --&gt; MavenProject.createArtifacts(..)
+     *     --&gt; MavenMetadataSource.createArtifacts(..)
+     *     &lt;-- InvalidDependencyVersionException
+     * &lt;-- ProjectBuildingException
+     * </pre>
+     */
+    void reportBadDependencyVersion( MavenProject project,
+                                     File pomFile,
+                                     InvalidDependencyVersionException cause );
+
+}

Propchange: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorReporter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorReporter.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorTips.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorTips.java?rev=598748&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorTips.java
(added)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorTips.java
Tue Nov 27 11:55:04 2007
@@ -0,0 +1,157 @@
+package org.apache.maven.project.error;
+
+import org.apache.maven.artifact.InvalidRepositoryException;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Model;
+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.project.InvalidProjectVersionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.interpolation.ModelInterpolationException;
+import org.apache.maven.project.validation.ModelValidationResult;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public final class ProjectErrorTips
+{
+
+    private ProjectErrorTips()
+    {
+    }
+
+    public static List<String> getTipsForActivatorErrorWhileApplyingProfiles( ProfileActivator
activator,
+                                                                              Model model,
+                                                                              File pomFile,
+                                                                              Profile profile,
+                                                                              ProfileActivationContext
context,
+                                                                              ProfileActivationException
cause )
+    {
+        return listOf( "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<String> getTipsForActivatorErrorWhileGettingRepositoriesFromProfiles(
ProfileActivator activator,
+                                                                                        
    String projectId,
+                                                                                        
    File pomFile,
+                                                                                        
    Profile profile,
+                                                                                        
    ProfileActivationContext context,
+                                                                                        
    ProfileActivationException cause )
+    {
+        return listOf( "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<String> getTipsForActivatorLookupErrorWhileApplyingProfiles(
Model model,
+                                                                                    File
pomFile,
+                                                                                    Profile
profile,
+                                                                                    ComponentLookupException
cause )
+    {
+        return listOf( "If this is a custom profile activator, please ensure the activator's
"
+                                       + "artifact is present in the POM's build/extensions
list.",
+                       "See http://maven.apache.org/pom.html#Extensions for more on build
extensions.",
+                       "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<String> getTipsForActivatorLookupErrorWhileGettingRepositoriesFromProfiles(
String projectId,
+                                                                                        
          File pomFile,
+                                                                                        
          Profile profile,
+                                                                                        
          ComponentLookupException cause )
+    {
+        return listOf( "If this is a custom profile activator, please ensure the activator's
"
+                                       + "artifact is present in the POM's build/extensions
list.",
+                       "See http://maven.apache.org/pom.html#Extensions for more on build
extensions.",
+                       "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<String> getTipsForErrorLoadingExternalProfilesFromFile( Model
model,
+                                                                               File pomFile,
+                                                                               File projectDir,
+                                                                               IOException
cause )
+    {
+        String profilesXmlPath = new File( projectDir, "profiles.xml" ).getAbsolutePath();
+
+        return listOf( "Please ensure the " + profilesXmlPath + " file exists and is readable."
);
+    }
+
+    public static List<String> getTipsForErrorLoadingExternalProfilesFromFile( Model
model,
+                                                                               File pomFile,
+                                                                               File projectDir,
+                                                                               XmlPullParserException
cause )
+    {
+        return listOf( "XSD location: http://maven.apache.org/xsd/profiles-1.0.0.xsd" );
+    }
+
+    public static List<String> getTipsForInvalidRepositorySpec( RepositoryBase repo,
+                                                                String projectId,
+                                                                File pomFile,
+                                                                InvalidRepositoryException
cause )
+    {
+        return listOf( "See http://maven.apache.org/pom.html#Repositories for more on custom
artifact repositories.",
+                       "See http://maven.apache.org/pom.html#PluginRepositories for more
on custom plugin repositories.",
+                       "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"
);
+    }
+
+    private static List<String> listOf( String... tips )
+    {
+        List<String> list = new ArrayList<String>();
+
+        for ( String tip : tips )
+        {
+            list.add( tip );
+        }
+
+        return list;
+    }
+
+    public static List<String> getTipsForProjectValidationFailure( MavenProject project,
+                                                                   File pomFile,
+                                                                   ModelValidationResult
validationResult )
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public static List<String> getTipsForBadDependencySpec( MavenProject project,
+                                                            File pomFile,
+                                                            Dependency dep )
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public static List<String> getTipsForBadNonDependencyArtifactSpec( MavenProject
project,
+                                                                       File pomFile,
+                                                                       InvalidProjectVersionException
cause )
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public static List<String> getTipsForProjectInterpolationError( MavenProject project,
+                                                                    File pomFile,
+                                                                    ModelInterpolationException
cause )
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}

Propchange: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorTips.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorTips.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message