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.Collection; 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 import org.apache.maven.api.annotations.Nullable; 27 28 /** 29 * {@code ArtifactCoordinates} completed with information about how the artifact will be used. 30 * This information include the dependency type (main classes, test classes, <i>etc.</i>), 31 * a scope (compile-time, run-time <i>etc.</i>), an obligation (whether the dependency 32 * is optional or mandatory), and possible exclusions for transitive dependencies. 33 * The {@linkplain #getVersionConstraint() version} and the {@linkplain #getOptional() obligation} 34 * may not be defined precisely. 35 * 36 * @since 4.0.0 37 */ 38 @Experimental 39 @Immutable 40 public interface DependencyCoordinates extends ArtifactCoordinates { 41 /** 42 * {@return the type of the dependency}. A dependency can be a <abbr>JAR</abbr> file, 43 * a modular-<abbr>JAR</abbr> if it is intended to be placed on the module-path, 44 * a <abbr>JAR</abbr> containing test classes, <i>etc.</i> 45 */ 46 @Nonnull 47 Type getType(); 48 49 /** 50 * {@return the time at which the dependency will be used}. 51 * If may be, for example, at compile time only, at run time or at test time. 52 */ 53 @Nonnull 54 DependencyScope getScope(); 55 56 /** 57 * Returns whether the dependency is optional, mandatory or of unspecified obligation. 58 * 59 * @return the obligation, or {@code null} if unspecified 60 */ 61 @Nullable 62 Boolean getOptional(); 63 64 /** 65 * {@return transitive dependencies to exclude}. 66 */ 67 @Nonnull 68 Collection<Exclusion> getExclusions(); 69 }