mirror of https://github.com/apache/maven.git
[MNG-6609] expose packaging via property "project.packaging" (#835)
This commit is contained in:
parent
0d70f7295d
commit
79b6dd0bab
|
@ -1046,7 +1046,14 @@ public class DefaultModelBuilder
|
|||
context.setActiveProfileIds( request.getActiveProfileIds() );
|
||||
context.setInactiveProfileIds( request.getInactiveProfileIds() );
|
||||
context.setSystemProperties( request.getSystemProperties() );
|
||||
context.setUserProperties( request.getUserProperties() );
|
||||
// enrich user properties with project packaging
|
||||
Properties userProperties = request.getUserProperties();
|
||||
if ( !userProperties.containsKey( ProfileActivationContext.PROPERTY_NAME_PACKAGING ) )
|
||||
{
|
||||
userProperties.put( ProfileActivationContext.PROPERTY_NAME_PACKAGING,
|
||||
request.getFileModel().getPackaging() );
|
||||
}
|
||||
context.setUserProperties( userProperties );
|
||||
context.setProjectDirectory( ( request.getPomFile() != null ) ? request.getPomFile().getParentFile() : null );
|
||||
|
||||
return context;
|
||||
|
|
|
@ -30,6 +30,12 @@ import java.util.Map;
|
|||
*/
|
||||
public interface ProfileActivationContext
|
||||
{
|
||||
/**
|
||||
* Key of the property containing the project's packaging.
|
||||
* Available in {@link #getUserProperties()}.
|
||||
* @since 4.0
|
||||
*/
|
||||
String PROPERTY_NAME_PACKAGING = "packaging";
|
||||
|
||||
/**
|
||||
* Gets the identifiers of those profiles that should be activated by explicit demand.
|
||||
|
|
Loading…
Reference in New Issue