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 * public void execute()
49 * {
50 * ProjectInstallerRequest pir =
51 * new ProjectInstallerRequest()
52 * .setProject( mavenProject );
53 *
54 * installer.install( session.getProjectBuildingRequest(), pir );
55 * }
56 * </pre>
57 *
58 * To set a different local repository than the current one in the Maven session, you can inject an instance of the
59 * <code>RepositoryManager</code> and set the path to the local repository, called <code>localRepositoryPath</code>,
60 * as such:
61 *
62 * <pre class="java">
63 * @Component
64 * private RepositoryManager repositoryManager;
65 *
66 * buildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepositoryPath );
67 * </pre>
68 *
69 * @param projectBuildingRequest {@link ProjectBuildingRequest}
70 * @param projectInstallerRequest {@link ProjectInstallerRequest}
71 * @throws IOException In case of problems related to checksums.
72 * @throws ArtifactInstallerException In case of problems to install artifacts.
73 * @throws NoFileAssignedException If no file has been assigned to the project.
74 * @throws IllegalArgumentException in case of parameter <code>projectBuildingRequest</code> is <code>null</code> or
75 * parameter <code>projectInstallerRequest</code> is <code>null</code>.
76 */
77 void install( ProjectBuildingRequest projectBuildingRequest, ProjectInstallerRequest projectInstallerRequest )
78 throws IOException, ArtifactInstallerException, NoFileAssignedException;
79
80 }