maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r307034 [2/2] - in /maven/components/trunk: maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/ maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/ maven-artifact-manager/src/main/java/org/apache/maven...
Date Fri, 07 Oct 2005 06:45:45 GMT
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java?rev=307034&r1=307033&r2=307034&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
Thu Oct  6 23:44:59 2005
@@ -17,6 +17,7 @@
  */
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Plugin;
@@ -39,10 +40,11 @@
     String ROLE = PluginManager.class.getName();
 
     void executeMojo( MavenProject project, MojoExecution execution, MavenSession session
)
-        throws MojoExecutionException, PluginManagerException, ArtifactResolutionException,
MojoFailureException;
+        throws MojoExecutionException, PluginManagerException, ArtifactResolutionException,
MojoFailureException,
+        ArtifactNotFoundException;
 
     MavenReport getReport( MavenProject project, MojoExecution mojoExecution, MavenSession
session )
-        throws PluginManagerException;
+        throws PluginManagerException, ArtifactNotFoundException;
 
     PluginDescriptor getPluginDescriptorForPrefix( String prefix );
 
@@ -51,10 +53,12 @@
 
     PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
                                    ArtifactRepository localRepository )
-        throws ArtifactResolutionException, PluginManagerException, PluginVersionResolutionException;
+        throws ArtifactResolutionException, PluginManagerException, PluginVersionResolutionException,
+        ArtifactNotFoundException;
 
     PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProject project,
MavenSession session )
-        throws PluginVersionResolutionException, ArtifactResolutionException, PluginManagerException;
+        throws PluginVersionResolutionException, ArtifactResolutionException, PluginManagerException,
+        ArtifactNotFoundException;
 
     Object getPluginComponent( Plugin plugin, String role, String roleHint )
         throws ComponentLookupException, PluginManagerException;

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginNotFoundException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginNotFoundException.java?rev=307034&r1=307033&r2=307034&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginNotFoundException.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginNotFoundException.java
Thu Oct  6 23:44:59 2005
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 
 /**
  * Exception occurring trying to resolve a plugin.
@@ -25,11 +25,11 @@
  * @version $Id$
  */
 public class PluginNotFoundException
-    extends ArtifactResolutionException
+    extends ArtifactNotFoundException
 {
-    public PluginNotFoundException( ArtifactResolutionException e )
+    public PluginNotFoundException( ArtifactNotFoundException e )
     {
-        super( "Mojo could not be found - check that the goal name is correct", e.getGroupId(),
e.getArtifactId(),
-               e.getVersion(), "maven-plugin", e.getRemoteRepositories(), e.getDownloadUrl(),
e );
+        super( "Plugin could not be found - check that the goal name is correct", e.getGroupId(),
e.getArtifactId(),
+               e.getVersion(), "maven-plugin", e.getRemoteRepositories(), e.getDownloadUrl(),
e.getCause() );
     }
 }

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java?rev=307034&r1=307033&r2=307034&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java
Thu Oct  6 23:44:59 2005
@@ -17,43 +17,45 @@
  */
 
 import org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 
 public class ArtifactResolverDiagnoser
     implements ErrorDiagnoser
 {
-    
+
     private WagonManager wagonManager;
 
     public boolean canDiagnose( Throwable error )
     {
-        return DiagnosisUtils.containsInCausality( error, ArtifactResolutionException.class
);
+        return DiagnosisUtils.containsInCausality( error, AbstractArtifactResolutionException.class
);
     }
 
     public String diagnose( Throwable error )
     {
-        ArtifactResolutionException exception = (ArtifactResolutionException) DiagnosisUtils.getFromCausality(
error, ArtifactResolutionException.class );
+        AbstractArtifactResolutionException exception = (AbstractArtifactResolutionException)
DiagnosisUtils.getFromCausality(
+            error, ArtifactResolutionException.class );
 
         StringBuffer message = new StringBuffer();
-        
+
         message.append( "Failed to resolve artifact." );
-        message.append( "\n\n");
+        message.append( "\n\n" );
         message.append( exception.getMessage() );
-        
+
         if ( !wagonManager.isOnline() )
         {
             message.append( "\n" ).append( DiagnosisUtils.getOfflineWarning() );
         }
 
         Throwable root = DiagnosisUtils.getRootCause( exception );
-        
+
         if ( root != null )
         {
             message.append( "\nRoot Cause: " ).append( root.getMessage() );
         }
-        
+
         message.append( "\n" );
-        
+
         return message.toString();
     }
 

Modified: maven/components/trunk/maven-plugins/maven-eclipse-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-eclipse-plugin/pom.xml?rev=307034&r1=307033&r2=307034&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-eclipse-plugin/pom.xml (original)
+++ maven/components/trunk/maven-plugins/maven-eclipse-plugin/pom.xml Thu Oct  6 23:44:59
2005
@@ -10,6 +10,9 @@
   <packaging>maven-plugin</packaging>
   <name>Maven Eclipse Plugin</name>
   <version>2.0-beta-2-SNAPSHOT</version>
+  <prerequisites>
+    <maven>2.0-beta-4-SNAPSHOT</maven>
+  </prerequisites>
   <dependencies>
     <dependency>
       <groupId>org.apache.maven</groupId>
@@ -21,8 +24,13 @@
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>2.0-beta-4-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
       <artifactId>maven-artifact-manager</artifactId>
-      <version>2.0-beta-3</version>
+      <version>2.0-beta-4-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
     <dependency>

Modified: maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseClasspathWriter.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseClasspathWriter.java?rev=307034&r1=307033&r2=307034&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseClasspathWriter.java
(original)
+++ maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseClasspathWriter.java
Thu Oct  6 23:44:59 2005
@@ -16,16 +16,10 @@
  * limitations under the License.
  */
 
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
 import org.apache.maven.plugin.logging.Log;
@@ -34,8 +28,16 @@
 import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
 import org.codehaus.plexus.util.xml.XMLWriter;
 
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
 /**
  * Writes eclipse .classpath file.
+ *
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @author <a href="mailto:kenney@neonics.com">Kenney Westerhof</a>
  * @author <a href="mailto:fgiust@users.sourceforge.net">Fabrizio Giustina</a>
@@ -52,13 +54,13 @@
     }
 
     /**
-     * @todo the list of needed parameters is really long, maybe this should become a Plexus
component
      * @param outputDirectory TODO
+     * @todo the list of needed parameters is really long, maybe this should become a Plexus
component
      */
     protected void write( File projectBaseDir, File basedir, MavenProject project, List referencedReactorArtifacts,
-                         EclipseSourceDir[] sourceDirs, List classpathContainers, ArtifactRepository
localRepository,
-                         ArtifactResolver artifactResolver, ArtifactFactory artifactFactory,
-                         List remoteArtifactRepositories, boolean downloadSources, String
outputDirectory )
+                          EclipseSourceDir[] sourceDirs, List classpathContainers, ArtifactRepository
localRepository,
+                          ArtifactResolver artifactResolver, ArtifactFactory artifactFactory,
+                          List remoteArtifactRepositories, boolean downloadSources, String
outputDirectory )
         throws EclipsePluginException
     {
 
@@ -70,7 +72,8 @@
         }
         catch ( IOException ex )
         {
-            throw new EclipsePluginException( Messages.getString( "EclipsePlugin.erroropeningfile"
), ex ); //$NON-NLS-1$
+            throw new EclipsePluginException( Messages.getString( "EclipsePlugin.erroropeningfile"
),
+                                              ex ); //$NON-NLS-1$
         }
 
         XMLWriter writer = new PrettyPrintXMLWriter( w );
@@ -105,7 +108,7 @@
         writer.startElement( "classpathentry" ); //$NON-NLS-1$
         writer.addAttribute( "kind", "output" ); //$NON-NLS-1$ //$NON-NLS-2$
         writer.addAttribute( "path", EclipseUtils.toRelativeAndFixSeparator( projectBaseDir,
 //$NON-NLS-1$  
-            outputDirectory, false ) );
+                                                                             outputDirectory,
false ) );
         writer.endElement();
 
         // ----------------------------------------------------------------------
@@ -150,9 +153,10 @@
     }
 
     private void addDependency( XMLWriter writer, Artifact artifact, List referencedReactorArtifacts,
-                               ArtifactRepository localRepository, ArtifactResolver artifactResolver,
-                               ArtifactFactory artifactFactory, List remoteArtifactRepositories,
-                               boolean downloadSources )
+                                ArtifactRepository localRepository, ArtifactResolver artifactResolver,
+                                ArtifactFactory artifactFactory, List remoteArtifactRepositories,
+                                boolean downloadSources )
+        throws EclipsePluginException
     {
 
         String path;
@@ -183,9 +187,9 @@
 
             if ( downloadSources )
             {
-            	Artifact sourceArtifact = retrieveSourceArtifact( artifact, remoteArtifactRepositories,
-                                                                  localRepository, artifactResolver,
artifactFactory );
-            	
+                Artifact sourceArtifact = retrieveSourceArtifact( artifact, remoteArtifactRepositories,
localRepository,
+                                                                  artifactResolver, artifactFactory
);
+
                 if ( !sourceArtifact.isResolved() )
                 {
                     log.info( Messages.getString( "EclipseClasspathWriter.sourcesnotavailable",
//$NON-NLS-1$
@@ -194,12 +198,12 @@
                 else
                 {
                     log.debug( Messages.getString( "EclipseClasspathWriter.sourcesavailable",
//$NON-NLS-1$
-                                                   new Object[] {
-                                                       sourceArtifact.getArtifactId(),
-                                                       sourceArtifact.getFile().getAbsolutePath()
} ) );
+                                                   new Object[]{sourceArtifact.getArtifactId(),
+                                                       sourceArtifact.getFile().getAbsolutePath()}
) );
 
                     sourcepath = "M2_REPO/" //$NON-NLS-1$
-                        + EclipseUtils.toRelativeAndFixSeparator( localRepositoryFile, sourceArtifact.getFile().getAbsolutePath(),
false );
+                        + EclipseUtils.toRelativeAndFixSeparator( localRepositoryFile,
+                                                                  sourceArtifact.getFile().getAbsolutePath(),
false );
                 }
 
             }
@@ -220,22 +224,26 @@
 
     }
 
-    
-    private Artifact retrieveSourceArtifact( Artifact artifact, List remoteArtifactRepositories,
ArtifactRepository localRepository, ArtifactResolver artifactResolver,
-                                       ArtifactFactory artifactFactory )
+
+    private Artifact retrieveSourceArtifact( Artifact artifact, List remoteArtifactRepositories,
+                                             ArtifactRepository localRepository, ArtifactResolver
artifactResolver,
+                                             ArtifactFactory artifactFactory )
+        throws EclipsePluginException
     {
         // source artifact: use the "sources" classifier added by the source plugin
-        Artifact sourceArtifact = artifactFactory.createArtifactWithClassifier( artifact.getGroupId(),
artifact
-            .getArtifactId(), artifact.getVersion(), "java-source", "sources" ); //$NON-NLS-1$
//$NON-NLS-2$
+        Artifact sourceArtifact = artifactFactory.createArtifactWithClassifier( artifact.getGroupId(),
+                                                                                artifact.getArtifactId(),
+                                                                                artifact.getVersion(),
"java-source",
+                                                                                "sources"
); //$NON-NLS-1$ //$NON-NLS-2$
 
         try
         {
             log.debug( Messages.getString( "EclipseClasspathWriter.lookingforsources", //$NON-NLS-1$
-                                               sourceArtifact.getArtifactId() ) );
+                                           sourceArtifact.getArtifactId() ) );
 
             artifactResolver.resolve( sourceArtifact, remoteArtifactRepositories, localRepository
);
         }
-        catch ( ArtifactResolutionException e )
+        catch ( ArtifactNotFoundException e )
         {
             // ignore, the jar has not been found
             if ( log.isDebugEnabled() )
@@ -243,7 +251,11 @@
                 log.debug( "Cannot resolve source artifact", e );
             }
         }
-        
+        catch ( ArtifactResolutionException e )
+        {
+            throw new EclipsePluginException( "Error getting soruce artifact", e );
+        }
+
         return sourceArtifact;
     }
 }

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=307034&r1=307033&r2=307034&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
Thu Oct  6 23:44:59 2005
@@ -24,6 +24,7 @@
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
@@ -153,7 +154,7 @@
 
     public MavenProject buildWithDependencies( File projectDescriptor, ArtifactRepository
localRepository,
                                                ProfileManager profileManager )
-        throws ProjectBuildingException, ArtifactResolutionException
+        throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException
     {
         return buildWithDependencies( projectDescriptor, localRepository, profileManager,
null );
     }
@@ -163,7 +164,7 @@
      */
     public MavenProject buildWithDependencies( File projectDescriptor, ArtifactRepository
localRepository,
                                                ProfileManager profileManager, TransferListener
transferListener )
-        throws ProjectBuildingException, ArtifactResolutionException
+        throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException
     {
         MavenProject project = buildFromSourceFile( projectDescriptor, localRepository, profileManager
);
 
@@ -373,8 +374,8 @@
 
                         if ( policy.checkOutOfDate( new Date( file.lastModified() ) ) )
                         {
-                            getLogger().info(
-                                projectArtifact.getArtifactId() + ": updating metadata due
to status of '" + status + "'" );
+                            getLogger().info( projectArtifact.getArtifactId() +
+                                ": updating metadata due to status of '" + status + "'" );
                             try
                             {
                                 projectArtifact.setResolved( false );
@@ -386,6 +387,13 @@
                                 getLogger().warn( "Error updating POM - using existing version"
);
                                 getLogger().debug( "Cause", e );
                             }
+                            catch ( ArtifactNotFoundException e )
+                            {
+                                getLogger().warn( "Error updating POM - not found. Removing
local copy." );
+                                getLogger().debug( "Cause", e );
+                                file.delete();
+                                throw e;
+                            }
                         }
                     }
 
@@ -407,10 +415,10 @@
             }
             catch ( ArtifactResolutionException e )
             {
-                // TODO: a not found would be better vs other errors
-                // only not found should have the below behaviour
-//                throw new ProjectBuildingException( "Unable to find the POM in the repository",
e );
-
+                throw new ProjectBuildingException( "Error getting the POM in the repository",
e );
+            }
+            catch ( ArtifactNotFoundException e )
+            {
                 model = createStubModel( projectArtifact );
             }
         }
@@ -422,7 +430,7 @@
         return model;
     }
 
-    private Model createStubModel(Artifact projectArtifact)
+    private Model createStubModel( Artifact projectArtifact )
     {
         getLogger().warn( "\n  ***** Using defaults for missing POM " + projectArtifact.getId()
+ " *****\n" );
 
@@ -676,10 +684,9 @@
                 "\'.\n\n  Reason(s):\n" + validationResult.render( "  " ) );
         }
 
-        project.setRemoteArtifactRepositories( ProjectUtils.buildArtifactRepositories( model.getRepositories(),
-                                                                                       artifactRepositoryFactory,
-                                                                                       container
) );
-        
+        project.setRemoteArtifactRepositories(
+            ProjectUtils.buildArtifactRepositories( model.getRepositories(), artifactRepositoryFactory,
container ) );
+
         // TODO: these aren't taking active project artifacts into consideration in the reactor
         project.setPluginArtifacts( createPluginArtifacts( project.getBuildPlugins() ) );
         project.setReportArtifacts( createReportArtifacts( project.getReportPlugins() ) );

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java?rev=307034&r1=307033&r2=307034&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
Thu Oct  6 23:44:59 2005
@@ -18,6 +18,7 @@
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.profiles.ProfileManager;
 import org.apache.maven.wagon.events.TransferListener;
@@ -44,11 +45,11 @@
 
     MavenProject buildWithDependencies( File project, ArtifactRepository localRepository,
                                         ProfileManager globalProfileManager, TransferListener
transferListener )
-        throws ProjectBuildingException, ArtifactResolutionException;
+        throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException;
 
     MavenProject buildWithDependencies( File project, ArtifactRepository localRepository,
                                         ProfileManager globalProfileManager )
-        throws ProjectBuildingException, ArtifactResolutionException;
+        throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException;
 
     // ----------------------------------------------------------------------
     //

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java?rev=307034&r1=307033&r2=307034&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java
Thu Oct  6 23:44:59 2005
@@ -21,6 +21,8 @@
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.project.MavenProject;
 
@@ -275,5 +277,17 @@
     public boolean isOptional()
     {
         return artifact.isOptional();
+    }
+
+    public ArtifactVersion getSelectedVersion()
+        throws OverConstrainedVersionException
+    {
+        return artifact.getSelectedVersion();
+    }
+
+    public boolean isSelectedVersionKnown()
+        throws OverConstrainedVersionException
+    {
+        return artifact.isSelectedVersionKnown();
     }
 }

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/AttachedArtifact.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/AttachedArtifact.java?rev=307034&r1=307033&r2=307034&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/AttachedArtifact.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/AttachedArtifact.java
Thu Oct  6 23:44:59 2005
@@ -1,5 +1,21 @@
 package org.apache.maven.project.artifact;
 
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.artifact.Artifact;
 import org.apache.maven.artifact.DefaultArtifact;
 import org.apache.maven.artifact.InvalidArtifactRTException;
@@ -19,19 +35,22 @@
 
     private final Artifact parent;
 
-    public AttachedArtifact ( Artifact parent, String type, String classifier )
+    public AttachedArtifact( Artifact parent, String type, String classifier )
     {
-        super( parent.getGroupId(), parent.getArtifactId(), parent.getVersionRange(), parent.getScope(),
type, classifier, parent.getArtifactHandler(), parent.isOptional() );
+        super( parent.getGroupId(), parent.getArtifactId(), parent.getVersionRange(), parent.getScope(),
type,
+               classifier, parent.getArtifactHandler(), parent.isOptional() );
         this.parent = parent;
-        
+
         if ( type == null || type.trim().length() < 1 )
         {
-            throw new InvalidArtifactRTException( getGroupId(), getArtifactId(), getVersion(),
type, "Attached artifacts must specify a type." );
+            throw new InvalidArtifactRTException( getGroupId(), getArtifactId(), getVersion(),
type,
+                                                  "Attached artifacts must specify a type."
);
         }
-        
+
         if ( classifier == null || classifier.trim().length() < 1 )
         {
-            throw new InvalidArtifactRTException( getGroupId(), getArtifactId(), getVersion(),
type, "Attached artifacts must specify a classifier." );
+            throw new InvalidArtifactRTException( getGroupId(), getArtifactId(), getVersion(),
type,
+                                                  "Attached artifacts must specify a classifier."
);
         }
     }
 

Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/TestArtifactResolver.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/TestArtifactResolver.java?rev=307034&r1=307033&r2=307034&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/TestArtifactResolver.java
(original)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/TestArtifactResolver.java
Thu Oct  6 23:44:59 2005
@@ -23,6 +23,7 @@
 import org.apache.maven.artifact.metadata.ResolutionGroup;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.artifact.resolver.DefaultArtifactResolver;
@@ -192,7 +193,7 @@
     public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact,
                                                          ArtifactRepository localRepository,
List remoteRepositories,
                                                          ArtifactMetadataSource source, ArtifactFilter
filter )
-        throws ArtifactResolutionException
+        throws ArtifactResolutionException, ArtifactNotFoundException
     {
         return super.resolveTransitively( artifacts, originatingArtifact, localRepository,
remoteRepositories,
                                           new Source( artifactFactory, repositoryFactory,
container ), filter );
@@ -201,7 +202,7 @@
     public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact,
                                                          List remoteRepositories, ArtifactRepository
localRepository,
                                                          ArtifactMetadataSource source )
-        throws ArtifactResolutionException
+        throws ArtifactResolutionException, ArtifactNotFoundException
     {
         return super.resolveTransitively( artifacts, originatingArtifact, remoteRepositories,
localRepository,
                                           new Source( artifactFactory, repositoryFactory,
container ) );



Mime
View raw message