View Javadoc

1   package org.apache.maven.artifact.resolver;
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.Artifact;
23  import org.apache.maven.artifact.versioning.VersionRange;
24  
25  /**
26   * Listens to the resolution process and handles events.
27   *
28   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
29   */
30  public interface ResolutionListener
31  {
32      String ROLE = ResolutionListener.class.getName();
33  
34      int TEST_ARTIFACT = 1;
35  
36      int PROCESS_CHILDREN = 2;
37  
38      int FINISH_PROCESSING_CHILDREN = 3;
39  
40      int INCLUDE_ARTIFACT = 4;
41  
42      int OMIT_FOR_NEARER = 5;
43  
44      int UPDATE_SCOPE = 6;
45  
46      @Deprecated
47      int MANAGE_ARTIFACT = 7;
48  
49      int OMIT_FOR_CYCLE = 8;
50  
51      /**
52       * this event means that the artifactScope has NOT been updated to a farther node artifactScope because current
53       * node is in the first level pom
54       */
55      int UPDATE_SCOPE_CURRENT_POM = 9;
56  
57      int SELECT_VERSION_FROM_RANGE = 10;
58  
59      int RESTRICT_RANGE = 11;
60  
61      int MANAGE_ARTIFACT_VERSION = 12;
62  
63      int MANAGE_ARTIFACT_SCOPE = 13;
64  
65      int MANAGE_ARTIFACT_SYSTEM_PATH = 14;
66  
67      void testArtifact( Artifact node );
68  
69      void startProcessChildren( Artifact artifact );
70  
71      void endProcessChildren( Artifact artifact );
72  
73      void includeArtifact( Artifact artifact );
74  
75      void omitForNearer( Artifact omitted,
76                          Artifact kept );
77  
78      void updateScope( Artifact artifact,
79                        String scope );
80  
81      @Deprecated
82      void manageArtifact( Artifact artifact,
83                           Artifact replacement );
84  
85      // TODO Use the following two instead of manageArtifact
86      // TODO Remove ResolutionListenerDM interface
87  
88      //void manageArtifactVersion( Artifact artifact, Artifact replacement );
89  
90      //void manageArtifactScope( Artifact artifact, Artifact replacement );
91  
92      void omitForCycle( Artifact artifact );
93  
94      /**
95       * This event means that the artifactScope has NOT been updated to a farther node artifactScope because current
96       * node is in the first level pom
97       *
98       * @param artifact     current node artifact, the one in the first level pom
99       * @param ignoredScope artifactScope that was ignored because artifact was in first level pom
100      */
101     void updateScopeCurrentPom( Artifact artifact,
102                                 String ignoredScope );
103 
104     void selectVersionFromRange( Artifact artifact );
105 
106     void restrictRange( Artifact artifact,
107                         Artifact replacement,
108                         VersionRange newRange );
109 }