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.project; 20 21 import java.util.Date; 22 import java.util.List; 23 import java.util.Properties; 24 25 import org.apache.maven.artifact.repository.ArtifactRepository; 26 import org.apache.maven.model.Profile; 27 import org.eclipse.aether.RepositorySystemSession; 28 29 /** 30 * ProjectBuildingRequest 31 */ 32 public interface ProjectBuildingRequest { 33 34 ProjectBuildingRequest setLocalRepository(ArtifactRepository localRepository); 35 36 ArtifactRepository getLocalRepository(); 37 38 ProjectBuildingRequest setRemoteRepositories(List<ArtifactRepository> remoteRepositories); 39 40 List<ArtifactRepository> getRemoteRepositories(); 41 42 ProjectBuildingRequest setPluginArtifactRepositories(List<ArtifactRepository> pluginArtifactRepositories); 43 44 List<ArtifactRepository> getPluginArtifactRepositories(); 45 46 /** 47 * Sets the system properties to use for interpolation and profile activation. The system properties are collected 48 * from the runtime environment like {@link System#getProperties()} and environment variables. 49 * 50 * @param systemProperties The system properties, may be {@code null}. 51 * @return This request, never {@code null}. 52 */ 53 ProjectBuildingRequest setSystemProperties(Properties systemProperties); 54 55 /** 56 * Gets the system properties to use for interpolation and profile activation. The system properties are collected 57 * from the runtime environment like {@link System#getProperties()} and environment variables. 58 * 59 * @return The system properties, never {@code null}. 60 */ 61 Properties getSystemProperties(); 62 63 /** 64 * Sets the user properties to use for interpolation and profile activation. The user properties have been 65 * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command 66 * line. 67 * 68 * @param userProperties The user properties, may be {@code null}. 69 * @return This request, never {@code null}. 70 */ 71 ProjectBuildingRequest setUserProperties(Properties userProperties); 72 73 /** 74 * Gets the user properties to use for interpolation and profile activation. The user properties have been 75 * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command 76 * line. 77 * 78 * @return The user properties, never {@code null}. 79 */ 80 Properties getUserProperties(); 81 82 void setProject(MavenProject mavenProject); 83 84 MavenProject getProject(); 85 86 ProjectBuildingRequest setProcessPlugins(boolean processPlugins); 87 88 boolean isProcessPlugins(); 89 90 ProjectBuildingRequest setResolveDependencies(boolean resolveDependencies); 91 92 boolean isResolveDependencies(); 93 94 /** 95 * Controls the level of validation to perform on processed models. By default, models are validated in strict mode. 96 * 97 * @param validationLevel The level of validation to perform on processed models, e.g. 98 * {@link org.apache.maven.model.building.ModelBuildingRequest#VALIDATION_LEVEL_STRICT}. 99 * @return This configuration, never {@code null}. 100 */ 101 ProjectBuildingRequest setValidationLevel(int validationLevel); 102 103 /** 104 * Gets the level of validation to perform on processed models. 105 * 106 * @return The level of validation to perform on processed models. 107 */ 108 int getValidationLevel(); 109 110 // Profiles 111 112 /** 113 * Set any active profiles that the {@link ProjectBuilder} should consider while constructing 114 * a {@link MavenProject}. 115 */ 116 void setActiveProfileIds(List<String> activeProfileIds); 117 118 List<String> getActiveProfileIds(); 119 120 void setInactiveProfileIds(List<String> inactiveProfileIds); 121 122 List<String> getInactiveProfileIds(); 123 124 /** 125 * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom 126 * configuration like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse. 127 * 128 * @param profile 129 */ 130 void addProfile(Profile profile); 131 132 void setProfiles(List<Profile> profiles); 133 134 List<Profile> getProfiles(); 135 136 /** 137 * Gets the start time of the build. 138 * 139 * @return The start time of the build or {@code null} if unknown. 140 */ 141 Date getBuildStartTime(); 142 143 /** 144 * Sets the start time of the build. 145 * 146 * @param buildStartTime The start time of the build, may be {@code null}. 147 */ 148 void setBuildStartTime(Date buildStartTime); 149 150 RepositorySystemSession getRepositorySession(); 151 152 ProjectBuildingRequest setRepositorySession(RepositorySystemSession repositorySession); 153 154 /** 155 * Sets the merge mode used to combine repositories declared in the POM with the repositories specified in this 156 * request. 157 * 158 * @param mode The repository merge mode, must not be {@code null}. 159 * @return This request for chaining, never {@code null}. 160 * @see #setRemoteRepositories(List) 161 */ 162 ProjectBuildingRequest setRepositoryMerging(RepositoryMerging mode); 163 164 /** 165 * Gets the merge mode used to combine repositories declared in the POM with the repositories specified in this 166 * request 167 * 168 * @return The merge mode, never {@code null}. 169 */ 170 RepositoryMerging getRepositoryMerging(); 171 172 /** 173 * @since 3.2.2 174 * @deprecated This got added when implementing MNG-2199 and is no longer used. 175 * Commit 6cf9320942c34bc68205425ab696b1712ace9ba4 updated the way 'MavenProject' objects are initialized. 176 */ 177 @Deprecated 178 boolean isResolveVersionRanges(); 179 180 /** 181 * @since 3.2.2 182 * @deprecated This got added when implementing MNG-2199 and is no longer used. 183 * Commit 6cf9320942c34bc68205425ab696b1712ace9ba4 updated the way 'MavenProject' objects are initialized. 184 */ 185 @Deprecated 186 ProjectBuildingRequest setResolveVersionRanges(boolean value); 187 188 /** 189 * The possible merge modes for combining remote repositories. 190 */ 191 enum RepositoryMerging { 192 193 /** 194 * The repositories declared in the POM have precedence over the repositories specified in the request. 195 */ 196 POM_DOMINANT, 197 198 /** 199 * The repositories specified in the request have precedence over the repositories declared in the POM. 200 */ 201 REQUEST_DOMINANT, 202 } 203 }