maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r771441 - in /maven/components/branches/MNG-2766: maven-embedder/src/main/java/org/apache/maven/embedder/execution/ maven-repository/src/main/java/org/apache/maven/repository/
Date Mon, 04 May 2009 21:05:28 GMT
Author: bentmann
Date: Mon May  4 21:05:28 2009
New Revision: 771441

URL: http://svn.apache.org/viewvc?rev=771441&view=rev
Log:
o Fixed creation of default remote repo (e.g. no snapshots from central)

Modified:
    maven/components/branches/MNG-2766/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
    maven/components/branches/MNG-2766/maven-repository/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java

Modified: maven/components/branches/MNG-2766/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java?rev=771441&r1=771440&r2=771441&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
(original)
+++ maven/components/branches/MNG-2766/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
Mon May  4 21:05:28 2009
@@ -210,7 +210,7 @@
             }
         }
 
-        if ( !definedRepositories.contains( "central" ) )
+        if ( !definedRepositories.contains( RepositorySystem.DEFAULT_REMOTE_REPO_ID ) )
         {            
             try
             {

Modified: maven/components/branches/MNG-2766/maven-repository/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-repository/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java?rev=771441&r1=771440&r2=771441&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-repository/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java
(original)
+++ maven/components/branches/MNG-2766/maven-repository/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java
Mon May  4 21:05:28 2009
@@ -317,7 +317,11 @@
     {
         try
         {
-            return createRepository( localRepository.toURI().toURL().toString(), RepositorySystem.DEFAULT_LOCAL_REPO_ID
);
+            return createRepository( localRepository.toURI().toURL().toString(),
+                                     RepositorySystem.DEFAULT_LOCAL_REPO_ID, true,
+                                     ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true,
+                                     ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
+                                     ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
         }
         catch ( MalformedURLException e )
         {
@@ -328,13 +332,19 @@
     public ArtifactRepository createDefaultRemoteRepository()
         throws InvalidRepositoryException
     {
-        return createRepository( RepositorySystem.DEFAULT_REMOTE_REPO_URL, RepositorySystem.DEFAULT_REMOTE_REPO_ID
);
+        return createRepository( RepositorySystem.DEFAULT_REMOTE_REPO_URL, RepositorySystem.DEFAULT_REMOTE_REPO_ID,
+                                 true, ArtifactRepositoryPolicy.UPDATE_POLICY_NEVER, false,
+                                 ArtifactRepositoryPolicy.UPDATE_POLICY_DAILY,
+                                 ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
     }
     
     public ArtifactRepository createLocalRepository( String url, String repositoryId )
         throws IOException
     {
-        return createRepository( canonicalFileUrl( url ), repositoryId );
+        return createRepository( canonicalFileUrl( url ), repositoryId, true,
+                                 ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true,
+                                 ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
+                                 ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
     }
 
     private String canonicalFileUrl( String url )
@@ -366,22 +376,18 @@
         return url;
     }
 
-    private ArtifactRepository createRepository( String url, String repositoryId )
+    private ArtifactRepository createRepository( String url, String repositoryId, boolean
releases,
+                                                 String releaseUpdates, boolean snapshots,
String snapshotUpdates,
+                                                 String checksumPolicy )
     {
-        // snapshots vs releases
-        // offline = to turning the update policy off
+        ArtifactRepositoryPolicy snapshotsPolicy =
+            new ArtifactRepositoryPolicy( snapshots, snapshotUpdates, checksumPolicy );
 
-        //TODO: we'll need to allow finer grained creation of repositories but this will
do for now
+        ArtifactRepositoryPolicy releasesPolicy =
+            new ArtifactRepositoryPolicy( releases, releaseUpdates, checksumPolicy );
 
-        String updatePolicyFlag = ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS;
-
-        String checksumPolicyFlag = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
-
-        ArtifactRepositoryPolicy snapshotsPolicy = new ArtifactRepositoryPolicy( true, updatePolicyFlag,
checksumPolicyFlag );
-
-        ArtifactRepositoryPolicy releasesPolicy = new ArtifactRepositoryPolicy( true, updatePolicyFlag,
checksumPolicyFlag );
-
-        return artifactRepositoryFactory.createArtifactRepository( repositoryId, url, defaultArtifactRepositoryLayout,
snapshotsPolicy, releasesPolicy );
+        return artifactRepositoryFactory.createArtifactRepository( repositoryId, url, defaultArtifactRepositoryLayout,
+                                                                   snapshotsPolicy, releasesPolicy
);
     }
 
     public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )



Mime
View raw message