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.resolver.internal.ant.types; 20 21 import org.apache.tools.ant.Task; 22 23 /** 24 * Common interface for Ant types that can contain Maven dependencies. 25 * <p> 26 * This interface is implemented by types such as {@link Dependency} and {@link Dependencies} 27 * to allow uniform handling of dependency validation within tasks like 28 * {@code <resolve>}, {@code <install>}, or {@code <createPom>}. 29 * </p> 30 * 31 * <p> 32 * Implementations must provide a {@link #validate(Task)} method that verifies 33 * their internal state is consistent and suitable for use during build execution. 34 * </p> 35 * 36 * <h2>Typical Implementations:</h2> 37 * <ul> 38 * <li>{@link Dependency} — defines a single Maven dependency</li> 39 * <li>{@link Dependencies} — defines a container of dependencies, POMs, or exclusions</li> 40 * </ul> 41 * 42 * @see Dependency 43 * @see Dependencies 44 */ 45 public interface DependencyContainer { 46 47 /** 48 * Validates the container's internal structure and attributes. 49 * <p> 50 * This method is typically invoked by Ant tasks during execution to ensure 51 * that dependency definitions are well-formed, unambiguous, and do not conflict. 52 * </p> 53 * 54 * @param task the Ant task requesting validation, typically used for error context 55 * 56 * @throws org.apache.tools.ant.BuildException if the container is misconfigured 57 */ 58 void validate(Task task); 59 }