001package org.apache.maven.project; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.util.Date; 023import java.util.List; 024import java.util.Properties; 025 026import org.apache.maven.artifact.repository.ArtifactRepository; 027import org.apache.maven.model.Profile; 028import org.apache.maven.model.building.ModelBuildingRequest; 029import org.eclipse.aether.RepositorySystemSession; 030 031public interface ProjectBuildingRequest 032{ 033 034 ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository ); 035 036 ArtifactRepository getLocalRepository(); 037 038 ProjectBuildingRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories ); 039 040 List<ArtifactRepository> getRemoteRepositories(); 041 042 ProjectBuildingRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifacgRepositories ); 043 044 List<ArtifactRepository> getPluginArtifactRepositories(); 045 046 /** 047 * Sets the system properties to use for interpolation and profile activation. The system properties are collected 048 * from the runtime environment like {@link System#getProperties()} and environment variables. 049 * 050 * @param systemProperties The system properties, may be {@code null}. 051 * @return This request, never {@code null}. 052 */ 053 ProjectBuildingRequest setSystemProperties( Properties systemProperties ); 054 055 /** 056 * Gets the system properties to use for interpolation and profile activation. The system properties are collected 057 * from the runtime environment like {@link System#getProperties()} and environment variables. 058 * 059 * @return The system properties, never {@code null}. 060 */ 061 Properties getSystemProperties(); 062 063 /** 064 * Sets the user properties to use for interpolation and profile activation. The user properties have been 065 * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command 066 * line. 067 * 068 * @param userProperties The user properties, may be {@code null}. 069 * @return This request, never {@code null}. 070 */ 071 ProjectBuildingRequest setUserProperties( Properties userProperties ); 072 073 /** 074 * Gets the user properties to use for interpolation and profile activation. The user properties have been 075 * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command 076 * line. 077 * 078 * @return The user properties, never {@code null}. 079 */ 080 Properties getUserProperties(); 081 082 void setProject( MavenProject mavenProject ); 083 084 MavenProject getProject(); 085 086 ProjectBuildingRequest setProcessPlugins( boolean processPlugins ); 087 088 boolean isProcessPlugins(); 089 090 ProjectBuildingRequest setResolveDependencies( boolean resolveDependencies ); 091 092 boolean isResolveDependencies(); 093 094 /** 095 * Controls the level of validation to perform on processed models. By default, models are validated in strict mode. 096 * 097 * @param validationLevel The level of validation to perform on processed models, e.g. 098 * {@link ModelBuildingRequest#VALIDATION_LEVEL_STRICT}. 099 * @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 * The possible merge modes for combining remote repositories. 174 */ 175 enum RepositoryMerging 176 { 177 178 /** 179 * The repositories declared in the POM have precedence over the repositories specified in the request. 180 */ 181 POM_DOMINANT, 182 183 /** 184 * The repositories specified in the request have precedence over the repositories declared in the POM. 185 */ 186 REQUEST_DOMINANT, 187 } 188 189}