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 738755 2009-01-29 04:19:04Z brett $
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  
45          return new ExclusionSetFilter( artifacts );
46      }
47  
48      public static ArtifactFilter createExtensionFilter()
49      {
50          Set artifacts = createBaseArtifactSet();
51  
52          // It should be safe to include wagon implementations, and since this is used by the extension manager they would
53          // get filtered out otherwise
54          
55          return new ExclusionSetFilter( artifacts );
56      }
57  
58      private static Set createBaseArtifactSet()
59      {
60          // TODO: configure this from bootstrap or scan lib
61          Set artifacts = new HashSet();
62  
63          artifacts.add( "classworlds" );
64          artifacts.add( "jsch" );
65          artifacts.add( "commons-cli" );
66          artifacts.add( "doxia-sink-api" );
67          artifacts.add( "doxia-logging-api" );
68          artifacts.add( "maven-artifact" );
69          artifacts.add( "maven-artifact-manager" );
70          artifacts.add( "maven-core" );
71          artifacts.add( "maven-error-diagnoser" );
72          artifacts.add( "maven-model" );
73          artifacts.add( "maven-monitor" );
74          artifacts.add( "maven-plugin-api" );
75          artifacts.add( "maven-plugin-descriptor" );
76          artifacts.add( "maven-plugin-parameter-documenter" );
77          artifacts.add( "maven-plugin-registry" );
78          artifacts.add( "maven-profile" );
79          artifacts.add( "maven-project" );
80          artifacts.add( "maven-reporting-api" );
81          artifacts.add( "maven-repository-metadata" );
82          artifacts.add( "maven-settings" );
83          artifacts.add( "plexus-container-default" );
84          artifacts.add( "plexus-interactivity-api" );
85          artifacts.add( "maven-toolchain" );
86          artifacts.add( "wagon-provider-api" );
87  
88          // drop the component-api - even though we don't use it directly it is included in out container-default
89          artifacts.add( "plexus-component-api" );
90          
91          return artifacts;
92      }
93  }