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} 43 * A dependency can be a <abbr>JAR</abbr> file, 44 * a modular-<abbr>JAR</abbr> if it is intended to be placed on the module-path, 45 * a <abbr>JAR</abbr> containing test classes, <i>etc.</i> 46 */ 47 @Nonnull 48 Type getType(); 49 50 /** 51 * {@return the time at which the dependency will be used} 52 * If may be, for example, at compile time only, at run time or at test time. 53 */ 54 @Nonnull 55 DependencyScope getScope(); 56 57 /** 58 * Returns whether the dependency is optional, mandatory or of unspecified obligation. 59 * 60 * @return the obligation, or {@code null} if unspecified 61 */ 62 @Nullable 63 Boolean getOptional(); 64 65 /** 66 * {@return transitive dependencies to exclude} 67 */ 68 @Nonnull 69 Collection<Exclusion> getExclusions(); 70 }