maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r810888 - in /maven/plugins/trunk/maven-remote-resources-plugin/src: main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java
Date Thu, 03 Sep 2009 10:53:37 GMT
Author: bentmann
Date: Thu Sep  3 10:53:37 2009
New Revision: 810888

URL: http://svn.apache.org/viewvc?rev=810888&view=rev
Log:
o Simplified code

Modified:
    maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java
    maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java

Modified: maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java?rev=810888&r1=810887&r2=810888&view=diff
==============================================================================
--- maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java
(original)
+++ maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java
Thu Sep  3 10:53:37 2009
@@ -21,10 +21,8 @@
 
 import org.apache.maven.ProjectDependenciesResolver;
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.InvalidRepositoryException;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 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.versioning.VersionRange;
@@ -41,7 +39,6 @@
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.project.ProjectUtils;
 import org.apache.maven.project.artifact.InvalidDependencyVersionException;
 import org.apache.maven.project.inheritance.ModelInheritanceAssembler;
 import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException;
@@ -184,15 +181,6 @@
     private ArtifactRepository localRepository;
 
     /**
-     * The remote repositories used as specified in your POM.
-     *
-     * @parameter expression="${project.repositories}"
-     * @readonly
-     * @required
-     */
-    private List repositories;
-
-    /**
      * List of Remote Repositories used by the resolver
      *
      * @parameter expression="${project.remoteArtifactRepositories}"
@@ -335,20 +323,6 @@
      */
     private MavenFileFilter fileFilter;
 
-    // These two things make this horrible. Maven artifact is way too complicated and the
relationship between
-    // the model usage and maven-artifact needs to be reworked as well as all our tools that
deal with it. The
-    // ProjectUtils should be a component so I don't have to expose the container and artifact
factory here. Can't
-    // change it now because it's not released ...
-
-    /**
-     * Artifact repository factory component.
-     *
-     * @component
-     * @readonly
-     * @required
-     */
-    private ArtifactRepositoryFactory artifactRepositoryFactory;
-
     /**
      * Artifact factory, needed to create artifacts.
      *
@@ -616,7 +590,7 @@
             Artifact artifact = (Artifact) it.next();
             try
             {
-                List remoteRepo = null;
+                List remoteRepo = remoteArtifactRepositories;
                 if ( artifact.isSnapshot() )
                 {
                     VersionRange rng = VersionRange.createFromVersion( artifact.getBaseVersion()
);
@@ -625,15 +599,6 @@
                                                                          artifact.getType(),
artifact.getClassifier(),
                                                                          artifact.getScope(),
null,
                                                                          artifact.isOptional()
);
-                    remoteRepo = remoteArtifactRepositories;
-                }
-                else
-                {
-                    remoteRepo =
-                        ProjectUtils.buildArtifactRepositories( repositories,
-                                                                artifactRepositoryFactory,
-                                                                mavenSession.getContainer()
);
-
                 }
 
                 getLog().debug( "Building project for " + artifact );
@@ -672,10 +637,6 @@
             {
                 throw new MojoExecutionException( e.getMessage(), e );
             }
-            catch ( InvalidRepositoryException e )
-            {
-                throw new MojoExecutionException( e.getMessage(), e );
-            }
         }
         Collections.sort( projects, new ProjectComparator() );
         return projects;
@@ -999,10 +960,7 @@
                 }
                 if ( artifact == null || !artifact.exists() )
                 {
-                    artifact = downloader.download( s[0], s[1], s[2], localRepository,
-                                                     ProjectUtils.buildArtifactRepositories(
repositories,
-                                                                                        
    artifactRepositoryFactory,
-                                                                                        
    mavenSession.getContainer() ) );
+                    artifact = downloader.download( s[0], s[1], s[2], localRepository, remoteArtifactRepositories
);
                 }
 
                 bundleArtifacts.add( artifact );
@@ -1016,10 +974,6 @@
         {
             throw new MojoExecutionException( "Resources JAR cannot be found.", e );
         }
-        catch ( InvalidRepositoryException e )
-        {
-            throw new MojoExecutionException( "Resources JAR cannot be found.", e );
-        }
 
         return bundleArtifacts;
     }

Modified: maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java?rev=810888&r1=810887&r2=810888&view=diff
==============================================================================
--- maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java
(original)
+++ maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java
Thu Sep  3 10:53:37 2009
@@ -396,7 +396,7 @@
         setVariableValueToObject( mojo, "outputDirectory", new File( project.getBuild().getOutputDirectory()
) );
         setVariableValueToObject( mojo, "resourceBundles", bundles );
         setVariableValueToObject( mojo, "mavenSession", session );
-        setVariableValueToObject( mojo, "repositories", project.getRemoteArtifactRepositories()
);
+        setVariableValueToObject( mojo, "remoteArtifactRepositories", project.getRemoteArtifactRepositories()
);
         setVariableValueToObject( mojo, "resources", project.getResources() );
         return mojo;
     }



Mime
View raw message