maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: maven-components/maven-core/src/main/java/org/apache/maven DefaultMaven.java
Date Wed, 16 Mar 2005 03:48:30 GMT
brett       2005/03/15 19:48:30

  Modified:    maven-core/src/main/java/org/apache/maven/cli MavenCli.java
               maven-core/src/main/java/org/apache/maven/execution
                        DefaultMavenExecutionRequest.java
                        MavenExecutionRequest.java
               maven-core/src/main/java/org/apache/maven DefaultMaven.java
  Log:
  PR: MNG-205
  Add a non-recursive mode to disable processing of modules
  
  Revision  Changes    Path
  1.21      +15 -6     maven-components/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
  
  Index: MavenCli.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- MavenCli.java	16 Mar 2005 01:43:09 -0000	1.20
  +++ MavenCli.java	16 Mar 2005 03:48:30 -0000	1.21
  @@ -133,11 +133,11 @@
           embedder.start( classWorld );
   
           UserModelBuilder userModelBuilder = (UserModelBuilder) embedder.lookup( UserModelBuilder.ROLE
);
  -        
  +
           UserModel userModel = userModelBuilder.buildUserModel();
  -        
  -        ArtifactRepositoryFactory artifactRepositoryFactory = (ArtifactRepositoryFactory)
embedder
  -                                                                                      
           .lookup( ArtifactRepositoryFactory.ROLE );
  +
  +        ArtifactRepositoryFactory artifactRepositoryFactory = (ArtifactRepositoryFactory)
embedder.lookup(
  +            ArtifactRepositoryFactory.ROLE );
   
           ArtifactRepository localRepository = getLocalRepository( userModel, artifactRepositoryFactory
);
   
  @@ -162,6 +162,11 @@
               }
               request = new DefaultMavenExecutionRequest( localRepository, userModel, eventDispatcher,
                                                           commandLine.getArgList(), files,
userDir.getPath() );
  +
  +            if ( commandLine.hasOption( CLIManager.NON_RECURSIVE ) )
  +            {
  +                request.setRecursive( false );
  +            }
           }
   
           LoggerManager manager = (LoggerManager) embedder.lookup( LoggerManager.ROLE );
  @@ -271,6 +276,8 @@
   
           private Options options = null;
   
  +        public static final char NON_RECURSIVE = 'N';
  +
           public CLIManager()
           {
               options = new Options();
  @@ -292,6 +299,8 @@
                   DEBUG ) );
               options.addOption( OptionBuilder.withLongOpt( "reactor" ).withDescription(
                   "Execute goals for project found in the reactor" ).create( REACTOR ) );
  +            options.addOption( OptionBuilder.withLongOpt( "non-recursive" ).withDescription(
  +                "Do not recurse into sub-projects" ).create( NON_RECURSIVE ) );
           }
   
           public CommandLine parse( String[] args )
  @@ -360,7 +369,7 @@
   
   // TODO [BP]: this should not be necessary - grep for and remove
           System.setProperty( MavenConstants.MAVEN_REPO_LOCAL, localRepository );
  -        
  +
           Repository repo = new Repository();
   
           repo.setId( "local" );
  
  
  
  1.3       +13 -1     maven-components/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
  
  Index: DefaultMavenExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultMavenExecutionRequest.java	15 Mar 2005 23:31:23 -0000	1.2
  +++ DefaultMavenExecutionRequest.java	16 Mar 2005 03:48:30 -0000	1.3
  @@ -51,6 +51,8 @@
   
       private final String baseDirectory;
   
  +    private boolean recursive = true;
  +
       public DefaultMavenExecutionRequest( ArtifactRepository localRepository, UserModel
userModel,
                                            EventDispatcher eventDispatcher, List goals, List
files, String baseDirectory )
       {
  @@ -77,6 +79,16 @@
           return baseDirectory;
       }
   
  +    public boolean isRecursive()
  +    {
  +        return recursive;
  +    }
  +
  +    public void setRecursive( boolean recursive )
  +    {
  +        this.recursive = false;
  +    }
  +
       public ArtifactRepository getLocalRepository()
       {
           return localRepository;
  
  
  
  1.12      +5 -1      maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
  
  Index: MavenExecutionRequest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- MavenExecutionRequest.java	15 Mar 2005 23:31:23 -0000	1.11
  +++ MavenExecutionRequest.java	16 Mar 2005 03:48:30 -0000	1.12
  @@ -52,4 +52,8 @@
       UserModel getUserModel();
   
       String getBaseDirectory();
  +
  +    void setRecursive( boolean recursive );
  +
  +    boolean isRecursive();
   }
  
  
  
  1.34      +5 -5      maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
  
  Index: DefaultMaven.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- DefaultMaven.java	16 Mar 2005 03:39:54 -0000	1.33
  +++ DefaultMaven.java	16 Mar 2005 03:48:30 -0000	1.34
  @@ -96,7 +96,7 @@
   
               try
               {
  -                projects = collectProjects( request.getFiles(), request.getLocalRepository()
);
  +                projects = collectProjects( request.getFiles(), request.getLocalRepository(),
request.isRecursive() );
   
                   projects = projectBuilder.getSortedProjects( projects );
   
  @@ -155,7 +155,7 @@
           }
       }
   
  -    private List collectProjects( List files, ArtifactRepository localRepository )
  +    private List collectProjects( List files, ArtifactRepository localRepository, boolean
recursive )
           throws ProjectBuildingException, ReactorException, IOException
       {
           List projects = new ArrayList( files.size() );
  @@ -166,7 +166,7 @@
   
               MavenProject project = getProject( file, localRepository );
   
  -            if ( project.getModules() != null && !project.getModules().isEmpty()
)
  +            if ( project.getModules() != null && !project.getModules().isEmpty()
&& recursive )
               {
                   project.setPackaging( "pom" );
   
  @@ -178,7 +178,7 @@
                   }
   
                   List moduleFiles = FileUtils.getFiles( project.getFile().getParentFile(),
includes, null );
  -                List collectedProjects = collectProjects( moduleFiles, localRepository
);
  +                List collectedProjects = collectProjects( moduleFiles, localRepository,
recursive );
                   projects.addAll( collectedProjects );
                   project.setCollectedProjects( collectedProjects );
               }
  
  
  

Mime
View raw message