1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.maven.api.plugin.annotations;
20
21 import java.lang.annotation.Documented;
22 import java.lang.annotation.ElementType;
23 import java.lang.annotation.Retention;
24 import java.lang.annotation.RetentionPolicy;
25 import java.lang.annotation.Target;
26
27 import org.apache.maven.api.annotations.Experimental;
28
29 /**
30 * Indicates that a given field will be injected with the result of
31 * a dependency collection or resolution request. Whether a collection
32 * or resolution request is performed is controlled by the {@link #pathScope()}
33 * field, the injected field type and the {@link #requestType()}.
34 * <p>
35 * If the {@code requestType} is not set explicitly, it will be inferred
36 * from the {@code pathScope} and the injected field type. If the type
37 * is {@link org.apache.maven.api.Node Node} and {@code pathScope == ""},
38 * then the dependencies will be <i>collected</i>.
39 * If the type is {@link org.apache.maven.api.Node Node} or
40 * {@code List<}{@link org.apache.maven.api.Node Node}{@code >},
41 * and {@code pathScope != ""}, the dependencies will be <i>flattened</i>.
42 * Else the dependencies will be <i>resolved</i> and {@code pathScope} must be non empty,
43 * and the field type can be {@link org.apache.maven.api.Node Node},
44 * {@code List<}{@link org.apache.maven.api.Node Node}{@code >},
45 * {@link org.apache.maven.api.services.DependencyResolverResult DependencyResolverResult},
46 * {@code List<}{@link java.nio.file.Path Path}{@code >},
47 * {@code Map<}{@link org.apache.maven.api.PathType PathType}{@code , List<}{@link java.nio.file.Path Path}{@code >>},
48 * or {@code Map<}{@link org.apache.maven.api.Dependency Dependency}{@code , }{@link java.nio.file.Path Path}{@code >}.
49 *
50 * @since 4.0.0
51 */
52 @Experimental
53 @Documented
54 @Retention(RetentionPolicy.RUNTIME)
55 @Target(ElementType.FIELD)
56 public @interface Resolution {
57
58 /**
59 * The id of a {@link org.apache.maven.api.PathScope} enum value.
60 * If specified, a dependency resolution request will be issued,
61 * else a dependency collection request will be done.
62 *
63 * @return the id of the path scope
64 */
65 String pathScope() default "";
66
67 /**
68 * The request type, in case the default one is not correct.
69 * Valid values are {@code collect}, {@code flatten}, or {@code resolve}.
70 *
71 * @return the request type
72 */
73 String requestType() default "";
74 }