1 package org.apache.maven.shared.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.artifact.install.ArtifactInstallerException; 26 import org.apache.maven.shared.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 * .setCreateChecksum( false ) 52 * .setUpdateReleaseInfo( false ); 53 * 54 * installer.install( session.getProjectBuildingRequest(), pir ); 55 * </pre> 56 * 57 * To set a different local repository than the current one in the Maven session, you can inject an instance of 58 * the <code>RepositoryManager</code> and set the path to the local repository, called 59 * <code>localRepositoryPath</code>, as such: 60 * 61 * <pre class="java"> 62 * @Component 63 * private RepositoryManager repositoryManager; 64 * 65 * buildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepositoryPath ); 66 * </pre> 67 * 68 * @param projectBuildingRequest {@link ProjectBuildingRequest} 69 * @param projectInstallerRequest {@link ProjectInstallerRequest} 70 * @throws IOException In case of problems related to checksums. 71 * @throws ArtifactInstallerException In case of problems to install artifacts. 72 * @throws NoFileAssignedException If no file has been assigned to the project. 73 */ 74 void install( ProjectBuildingRequest projectBuildingRequest, ProjectInstallerRequest projectInstallerRequest ) 75 throws IOException, ArtifactInstallerException, NoFileAssignedException; 76 77 }