1 package org.apache.maven.shared.transfer.project.install;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.io.IOException;
23
24 import org.apache.maven.project.ProjectBuildingRequest;
25 import org.apache.maven.shared.transfer.artifact.install.ArtifactInstallerException;
26 import org.apache.maven.shared.transfer.project.NoFileAssignedException;
27
28 /**
29 * This defines the interface to install a single Maven Project.
30 *
31 * @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmarbaise@apache.org</a>
32 */
33 public interface ProjectInstaller
34 {
35 /**
36 * This will install a single project which may contain several artifacts. Those artifacts will be installed into
37 * the appropriate repository.
38 *
39 * <pre class="java">
40 * @Parameter( defaultValue = "${session}", required=true, readonly = true)
41 * private MavenSession session;
42 * @Parameter( defaultValue = "${project}", required=true, readonly = true)
43 * private MavenProject project;
44 * ..
45 * @Component
46 * private ProjectInstaller installer;
47 *
48 * ProjectInstallerRequest pir =
49 * new ProjectInstallerRequest()
50 * .setProject( mavenProject );
51 *
52 * installer.install( session.getProjectBuildingRequest(), pir );
53 * </pre>
54 *
55 * To set a different local repository than the current one in the Maven session, you can inject an instance of the
56 * <code>RepositoryManager</code> and set the path to the local repository, called <code>localRepositoryPath</code>,
57 * as such:
58 *
59 * <pre class="java">
60 * @Component
61 * private RepositoryManager repositoryManager;
62 *
63 * buildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepositoryPath );
64 * </pre>
65 *
66 * @param projectBuildingRequest {@link ProjectBuildingRequest}
67 * @param projectInstallerRequest {@link ProjectInstallerRequest}
68 * @throws IOException In case of problems related to checksums.
69 * @throws ArtifactInstallerException In case of problems to install artifacts.
70 * @throws NoFileAssignedException If no file has been assigned to the project.
71 * @throws IllegalArgumentException in case of parameter <code>projectBuildingRequest</code> is <code>null</code> or
72 * parameter <code>projectInstallerRequest</code> is <code>null</code>.
73 */
74 void install( ProjectBuildingRequest projectBuildingRequest, ProjectInstallerRequest projectInstallerRequest )
75 throws IOException, ArtifactInstallerException, NoFileAssignedException;
76
77 }