View Javadoc

1   package org.apache.maven;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
23  import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
24  
25  import java.util.Set;
26  import java.util.HashSet;
27  
28  /**
29   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
30   * @version $Id: MavenArtifactFilterManager.java 788791 2009-06-26 17:55:26Z jdcasey $
31   * @todo this should probably be a component with some dynamic control of filtering
32   */
33  public class MavenArtifactFilterManager
34  {
35      public static ArtifactFilter createStandardFilter()
36      {
37          Set artifacts = createBaseArtifactSet();
38  
39          artifacts.add( "wagon-file" );
40          artifacts.add( "wagon-http-lightweight" );
41          artifacts.add( "wagon-webdav" );
42          artifacts.add( "wagon-ssh" );
43          artifacts.add( "wagon-ssh-external" );
44          artifacts.add( "wagon-ssh-common" );
45          artifacts.add( "wagon-http-shared" );
46          artifacts.add( "wagon-webdav-jackrabbit" );
47  
48          return new ExclusionSetFilter( artifacts );
49      }
50  
51      public static ArtifactFilter createExtensionFilter()
52      {
53          Set artifacts = createBaseArtifactSet();
54  
55          // It should be safe to include wagon implementations, and since this is used by the extension manager they would
56          // get filtered out otherwise
57          
58          return new ExclusionSetFilter( artifacts );
59      }
60  
61      private static Set createBaseArtifactSet()
62      {
63          // TODO: configure this from bootstrap or scan lib
64          Set artifacts = new HashSet();
65  
66          artifacts.add( "classworlds" );
67          artifacts.add( "jsch" );
68  //        artifacts.add( "commons-cli" );
69          artifacts.add( "doxia-sink-api" );
70          artifacts.add( "doxia-logging-api" );
71          artifacts.add( "maven-artifact" );
72          artifacts.add( "maven-artifact-manager" );
73          artifacts.add( "maven-core" );
74          artifacts.add( "maven-error-diagnoser" );
75          artifacts.add( "maven-model" );
76          artifacts.add( "maven-monitor" );
77          artifacts.add( "maven-plugin-api" );
78          artifacts.add( "maven-plugin-descriptor" );
79          artifacts.add( "maven-plugin-parameter-documenter" );
80          artifacts.add( "maven-plugin-registry" );
81          artifacts.add( "maven-profile" );
82          artifacts.add( "maven-project" );
83          artifacts.add( "maven-reporting-api" );
84          artifacts.add( "maven-repository-metadata" );
85          artifacts.add( "maven-settings" );
86          artifacts.add( "plexus-container-default" );
87          artifacts.add( "plexus-interactivity-api" );
88          artifacts.add( "maven-toolchain" );
89          artifacts.add( "wagon-provider-api" );
90  
91          // drop the component-api - even though we don't use it directly it is included in out container-default
92          artifacts.add( "plexus-component-api" );
93          
94          return artifacts;
95      }
96  }