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;
20
21 import java.util.Set;
22
23 import org.apache.maven.api.annotations.Experimental;
24 import org.apache.maven.api.annotations.Immutable;
25 import org.apache.maven.api.annotations.Nonnull;
26
27 import static org.apache.maven.api.ExtensibleEnums.pathScope;
28
29 /**
30 * Path scope.
31 * A path scope is used to determine the kind of build or class path that will be built when resolving
32 * dependencies using the {@link org.apache.maven.api.services.DependencyResolver} service.
33 * <p>
34 * This extensible enum has four defined values, {@link #MAIN_COMPILE}, {@link #MAIN_RUNTIME},
35 * {@link #TEST_COMPILE} and {@link #TEST_RUNTIME}, but can be extended by registering a
36 * {@code org.apache.maven.api.spi.PathScopeProvider}.
37 * <p>
38 * Implementation must have {@code equals()} and {@code hashCode()} implemented, so implementations of this interface
39 * can be used as keys.
40 *
41 * @since 4.0.0
42 * @see org.apache.maven.api.services.DependencyResolver
43 * @see DependencyScope
44 */
45 @Experimental
46 @Immutable
47 public interface PathScope extends ExtensibleEnum {
48
49 // TODO: what if I simply want all dependencies ?
50 @Nonnull
51 ProjectScope projectScope();
52
53 @Nonnull
54 Set<DependencyScope> dependencyScopes();
55
56 PathScope MAIN_COMPILE = pathScope(
57 "main-compile",
58 ProjectScope.MAIN,
59 DependencyScope.COMPILE_ONLY,
60 DependencyScope.COMPILE,
61 DependencyScope.PROVIDED);
62
63 PathScope MAIN_RUNTIME =
64 pathScope("main-runtime", ProjectScope.MAIN, DependencyScope.COMPILE, DependencyScope.RUNTIME);
65
66 PathScope TEST_COMPILE = pathScope(
67 "test-compile",
68 ProjectScope.TEST,
69 DependencyScope.COMPILE,
70 DependencyScope.PROVIDED,
71 DependencyScope.TEST_ONLY,
72 DependencyScope.TEST);
73
74 PathScope TEST_RUNTIME = pathScope(
75 "test-runtime",
76 ProjectScope.TEST,
77 DependencyScope.COMPILE,
78 DependencyScope.RUNTIME,
79 DependencyScope.PROVIDED,
80 DependencyScope.TEST,
81 DependencyScope.TEST_RUNTIME);
82 }