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.toolchain;
20
21 import java.util.List;
22 import java.util.Map;
23
24 import org.apache.maven.execution.MavenSession;
25
26 /**
27 * Public API for a toolchain-aware plugin to get expected toolchain instance.
28 *
29 * @since 2.0.9
30 * @deprecated Use {@link org.apache.maven.api.services.ToolchainManager} instead.
31 */
32 @Deprecated(since = "4.0.0")
33 public interface ToolchainManager {
34
35 // NOTE: Some plugins like Surefire access this field directly!
36 @Deprecated
37 String ROLE = ToolchainManager.class.getName();
38
39 /**
40 * Retrieve toolchain of specified type from build context. It is expected that
41 * <code>maven-toolchains-plugin</code> contains the configuration to select the appropriate
42 * toolchain and is executed at the beginning of the build.
43 *
44 * @param type the type, must not be {@code null}
45 * @param context the Maven session, must not be {@code null}
46 * @return the toolchain selected by <code>maven-toolchains-plugin</code>
47 */
48 Toolchain getToolchainFromBuildContext(String type, MavenSession context);
49
50 /**
51 * Select all toolchains available in user settings matching the type and requirements,
52 * independently from <code>maven-toolchains-plugin</code>.
53 *
54 * @param session the Maven session, must not be {@code null}
55 * @param type the type, must not be {@code null}
56 * @param requirements the requirements, may be {@code null}
57 * @return the matching toolchains, never {@code null}
58 * @since 3.3.0
59 */
60 List<Toolchain> getToolchains(MavenSession session, String type, Map<String, String> requirements);
61 }