continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r720076 - /continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java
Date Mon, 24 Nov 2008 00:13:07 GMT
Author: ctan
Date: Sun Nov 23 16:13:07 2008
New Revision: 720076

URL: http://svn.apache.org/viewvc?rev=720076&view=rev
Log:
merge -r 720074:720075 from continuum-1.2.x branch
[CONTINUUM-1987] fixed release error when local repo used is different from the local repo
in settings.xml

Modified:
    continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java

Modified: continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java?rev=720076&r1=720075&r2=720076&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java
(original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java
Sun Nov 23 16:13:07 2008
@@ -101,12 +101,14 @@
         MavenProject project;
         try
         {
+            ArtifactRepository repository = getLocalRepository( descriptor.getAdditionalArguments()
);
+
             project = projectBuilder.buildWithDependencies( getProjectDescriptorFile( descriptor
),
-                                                            getLocalRepository(), getProfileManager(
getSettings() ) );
+                                                            repository, getProfileManager(
getSettings() ) );
 
             reactorProjects.add( project );
 
-            addModules( reactorProjects, project );
+            addModules( reactorProjects, project, repository );
         }
         catch ( ProjectBuildingException e )
         {
@@ -137,7 +139,7 @@
         return reactorProjects;
     }
 
-    private void addModules( List reactorProjects, MavenProject project )
+    private void addModules( List reactorProjects, MavenProject project, ArtifactRepository
repository )
         throws ContinuumReleaseException
     {
         for ( Iterator modules = project.getModules().iterator(); modules.hasNext(); )
@@ -148,13 +150,13 @@
 
             try
             {
-                MavenProject reactorProject = projectBuilder.buildWithDependencies( pomFile,
getLocalRepository(),
+                MavenProject reactorProject = projectBuilder.buildWithDependencies( pomFile,
repository,
                                                                                     getProfileManager(
                                                                                         getSettings()
) );
 
                 reactorProjects.add( reactorProject );
 
-                addModules( reactorProjects, reactorProject );
+                addModules( reactorProjects, reactorProject, repository );
             }
             catch ( ProjectBuildingException e )
             {
@@ -184,10 +186,35 @@
         return new File( parentPath, pomFilename );
     }
 
-    private ArtifactRepository getLocalRepository()
+    private ArtifactRepository getLocalRepository( String arguments )
         throws ContinuumReleaseException
     {
-        return new DefaultArtifactRepository( "local-repository", "file://" + getSettings().getLocalRepository(),
+        String localRepository = null;
+
+        if ( arguments != null )
+        {
+            String[] args = arguments.split( " " );
+            
+            for ( int i = 0; i < args.length; i++ )
+            {
+                if ( args[i].contains( "-Dmaven.repo.local=" ) )
+                {
+                    localRepository = args[i].substring( args[i].indexOf( "=" ) + 1 );
+                    break;
+                }
+            }
+        }
+
+        if ( localRepository == null )
+        {
+            localRepository = getSettings().getLocalRepository();
+        }
+        else if ( localRepository.endsWith( "\"" ) )
+        {
+            localRepository = localRepository.substring( 0, localRepository.indexOf( "\""
) );
+        }
+
+        return new DefaultArtifactRepository( "local-repository", "file://" + localRepository,
                                               new DefaultRepositoryLayout() );
     }
 



Mime
View raw message