mirror of https://github.com/apache/maven.git
fixed errors reported by Checkstyle
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@813627 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a1803e5a48
commit
05b59c8935
|
@ -29,7 +29,7 @@ import org.apache.maven.model.resolution.ModelResolver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collects settings that control the building of effective models.
|
* Collects settings that control the building of effective models.
|
||||||
*
|
*
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
*/
|
*/
|
||||||
public interface ModelBuildingRequest
|
public interface ModelBuildingRequest
|
||||||
|
@ -39,32 +39,32 @@ public interface ModelBuildingRequest
|
||||||
* Denotes minimal validation of POMs. This validation level is meant for processing of POMs from repositories
|
* Denotes minimal validation of POMs. This validation level is meant for processing of POMs from repositories
|
||||||
* during metadata retrieval.
|
* during metadata retrieval.
|
||||||
*/
|
*/
|
||||||
static final int VALIDATION_LEVEL_MINIMAL = 0;
|
int VALIDATION_LEVEL_MINIMAL = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes validation as performed by Maven 2.0. This validation level is meant as a compatibility mode to allow
|
* Denotes validation as performed by Maven 2.0. This validation level is meant as a compatibility mode to allow
|
||||||
* users to migrate their projects.
|
* users to migrate their projects.
|
||||||
*/
|
*/
|
||||||
static final int VALIDATION_LEVEL_MAVEN_2_0 = 20;
|
int VALIDATION_LEVEL_MAVEN_2_0 = 20;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes validation as performed by Maven 3.0. This validation level is meant for existing projects.
|
* Denotes validation as performed by Maven 3.0. This validation level is meant for existing projects.
|
||||||
*/
|
*/
|
||||||
static final int VALIDATION_LEVEL_MAVEN_3_0 = 30;
|
int VALIDATION_LEVEL_MAVEN_3_0 = 30;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes validation as performed by Maven 3.1. This validation level is meant for new projects.
|
* Denotes validation as performed by Maven 3.1. This validation level is meant for new projects.
|
||||||
*/
|
*/
|
||||||
static final int VALIDATION_LEVEL_MAVEN_3_1 = 31;
|
int VALIDATION_LEVEL_MAVEN_3_1 = 31;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes strict validation as recommended by the current Maven version.
|
* Denotes strict validation as recommended by the current Maven version.
|
||||||
*/
|
*/
|
||||||
static final int VALIDATION_LEVEL_STRICT = VALIDATION_LEVEL_MAVEN_3_0;
|
int VALIDATION_LEVEL_STRICT = VALIDATION_LEVEL_MAVEN_3_0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the source of the POM to process.
|
* Gets the source of the POM to process.
|
||||||
*
|
*
|
||||||
* @return The source of the POM or {@code null} if not set.
|
* @return The source of the POM or {@code null} if not set.
|
||||||
*/
|
*/
|
||||||
ModelSource getModelSource();
|
ModelSource getModelSource();
|
||||||
|
@ -72,7 +72,7 @@ public interface ModelBuildingRequest
|
||||||
/**
|
/**
|
||||||
* Sets the source of the POM to process. Eventually, either {@link #setModelSource(ModelSource)} or
|
* Sets the source of the POM to process. Eventually, either {@link #setModelSource(ModelSource)} or
|
||||||
* {@link #setPomFile(File)} must be set.
|
* {@link #setPomFile(File)} must be set.
|
||||||
*
|
*
|
||||||
* @param modelSource The source of the POM to process, may be {@code null}.
|
* @param modelSource The source of the POM to process, may be {@code null}.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@ -80,7 +80,7 @@ public interface ModelBuildingRequest
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the POM file of the project to build.
|
* Gets the POM file of the project to build.
|
||||||
*
|
*
|
||||||
* @return The POM file of the project or {@code null} if not applicable (i.e. when processing a POM from the
|
* @return The POM file of the project or {@code null} if not applicable (i.e. when processing a POM from the
|
||||||
* repository).
|
* repository).
|
||||||
*/
|
*/
|
||||||
|
@ -92,7 +92,7 @@ public interface ModelBuildingRequest
|
||||||
* build process of a local project. Hence the effective model will support the notion of a project directory. To
|
* build process of a local project. Hence the effective model will support the notion of a project directory. To
|
||||||
* build the model for a POM from the repository, use {@link #setModelSource(ModelSource)} in combination with a
|
* build the model for a POM from the repository, use {@link #setModelSource(ModelSource)} in combination with a
|
||||||
* {@link FileModelSource} instead.
|
* {@link FileModelSource} instead.
|
||||||
*
|
*
|
||||||
* @param pomFile The POM file of the project to build the effective model for, may be {@code null} to build the
|
* @param pomFile The POM file of the project to build the effective model for, may be {@code null} to build the
|
||||||
* model of some POM from the repository.
|
* model of some POM from the repository.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
|
@ -101,7 +101,7 @@ public interface ModelBuildingRequest
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the level of validation to perform on processed models.
|
* Gets the level of validation to perform on processed models.
|
||||||
*
|
*
|
||||||
* @return The level of validation to perform on processed models.
|
* @return The level of validation to perform on processed models.
|
||||||
*/
|
*/
|
||||||
int getValidationLevel();
|
int getValidationLevel();
|
||||||
|
@ -111,7 +111,7 @@ public interface ModelBuildingRequest
|
||||||
* {@link #VALIDATION_LEVEL_STRICT} should be used to ensure proper building. For the mere retrievel of dependencies
|
* {@link #VALIDATION_LEVEL_STRICT} should be used to ensure proper building. For the mere retrievel of dependencies
|
||||||
* during artifact resolution, {@link #VALIDATION_LEVEL_MINIMAL} should be used to account for models of poor
|
* during artifact resolution, {@link #VALIDATION_LEVEL_MINIMAL} should be used to account for models of poor
|
||||||
* quality. By default, models are validated in strict mode.
|
* quality. By default, models are validated in strict mode.
|
||||||
*
|
*
|
||||||
* @param validationLevel The level of validation to perform on processed models.
|
* @param validationLevel The level of validation to perform on processed models.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@ -121,14 +121,14 @@ public interface ModelBuildingRequest
|
||||||
* Indicates whether plugin executions and configurations should be processed. If enabled, lifecycle-induced plugin
|
* Indicates whether plugin executions and configurations should be processed. If enabled, lifecycle-induced plugin
|
||||||
* executions will be injected into the model and common plugin configuration will be propagated to individual
|
* executions will be injected into the model and common plugin configuration will be propagated to individual
|
||||||
* executions.
|
* executions.
|
||||||
*
|
*
|
||||||
* @return {@code true} if plugins should be processed, {@code false} otherwise.
|
* @return {@code true} if plugins should be processed, {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
boolean isProcessPlugins();
|
boolean isProcessPlugins();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls the processing of plugin executions and configurations.
|
* Controls the processing of plugin executions and configurations.
|
||||||
*
|
*
|
||||||
* @param processPlugins {@code true} to enable plugin processing, {@code false} otherwise.
|
* @param processPlugins {@code true} to enable plugin processing, {@code false} otherwise.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@ -138,7 +138,7 @@ public interface ModelBuildingRequest
|
||||||
* Indicates whether the model building should happen in two phases. If enabled, the initial invocation of the model
|
* Indicates whether the model building should happen in two phases. If enabled, the initial invocation of the model
|
||||||
* builder will only produce an interim result which may be used to analyze inter-model dependencies before the
|
* builder will only produce an interim result which may be used to analyze inter-model dependencies before the
|
||||||
* final invocation of the model builder is performed.
|
* final invocation of the model builder is performed.
|
||||||
*
|
*
|
||||||
* @return {@code true} if two-phase building is enabled, {@code false} if the model should be build in a single
|
* @return {@code true} if two-phase building is enabled, {@code false} if the model should be build in a single
|
||||||
* step.
|
* step.
|
||||||
*/
|
*/
|
||||||
|
@ -148,7 +148,7 @@ public interface ModelBuildingRequest
|
||||||
* Enables/disables two-phase building. If enabled, the initial invocation of the model builder will only produce an
|
* Enables/disables two-phase building. If enabled, the initial invocation of the model builder will only produce an
|
||||||
* interim result which may be used to analyze inter-model dependencies before the final invocation of the model
|
* interim result which may be used to analyze inter-model dependencies before the final invocation of the model
|
||||||
* builder is performed.
|
* builder is performed.
|
||||||
*
|
*
|
||||||
* @param twoPhaseBuilding {@code true} to enable two-phase building, {@code false} if the model should be build in
|
* @param twoPhaseBuilding {@code true} to enable two-phase building, {@code false} if the model should be build in
|
||||||
* a single step.
|
* a single step.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
|
@ -157,14 +157,14 @@ public interface ModelBuildingRequest
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the external profiles that should be considered for model building.
|
* Gets the external profiles that should be considered for model building.
|
||||||
*
|
*
|
||||||
* @return The external profiles that should be considered for model building, never {@code null}.
|
* @return The external profiles that should be considered for model building, never {@code null}.
|
||||||
*/
|
*/
|
||||||
List<Profile> getProfiles();
|
List<Profile> getProfiles();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the external profiles that should be considered for model building.
|
* Sets the external profiles that should be considered for model building.
|
||||||
*
|
*
|
||||||
* @param profiles The external profiles that should be considered for model building, may be {@code null}.
|
* @param profiles The external profiles that should be considered for model building, may be {@code null}.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@ -172,14 +172,14 @@ public interface ModelBuildingRequest
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the identifiers of those profiles that should be activated by explicit demand.
|
* Gets the identifiers of those profiles that should be activated by explicit demand.
|
||||||
*
|
*
|
||||||
* @return The identifiers of those profiles to activate, never {@code null}.
|
* @return The identifiers of those profiles to activate, never {@code null}.
|
||||||
*/
|
*/
|
||||||
List<String> getActiveProfileIds();
|
List<String> getActiveProfileIds();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the identifiers of those profiles that should be activated by explicit demand.
|
* Sets the identifiers of those profiles that should be activated by explicit demand.
|
||||||
*
|
*
|
||||||
* @param activeProfileIds The identifiers of those profiles to activate, may be {@code null}.
|
* @param activeProfileIds The identifiers of those profiles to activate, may be {@code null}.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@ -187,14 +187,14 @@ public interface ModelBuildingRequest
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the identifiers of those profiles that should be deactivated by explicit demand.
|
* Gets the identifiers of those profiles that should be deactivated by explicit demand.
|
||||||
*
|
*
|
||||||
* @return The identifiers of those profiles to deactivate, never {@code null}.
|
* @return The identifiers of those profiles to deactivate, never {@code null}.
|
||||||
*/
|
*/
|
||||||
List<String> getInactiveProfileIds();
|
List<String> getInactiveProfileIds();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the identifiers of those profiles that should be deactivated by explicit demand.
|
* Sets the identifiers of those profiles that should be deactivated by explicit demand.
|
||||||
*
|
*
|
||||||
* @param inactiveProfileIds The identifiers of those profiles to deactivate, may be {@code null}.
|
* @param inactiveProfileIds The identifiers of those profiles to deactivate, may be {@code null}.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@ -203,7 +203,7 @@ public interface ModelBuildingRequest
|
||||||
/**
|
/**
|
||||||
* Gets the system properties to use for interpolation and profile activation. The system properties are collected
|
* Gets the system properties to use for interpolation and profile activation. The system properties are collected
|
||||||
* from the runtime environment like {@link System#getProperties()} and environment variables.
|
* from the runtime environment like {@link System#getProperties()} and environment variables.
|
||||||
*
|
*
|
||||||
* @return The system properties, never {@code null}.
|
* @return The system properties, never {@code null}.
|
||||||
*/
|
*/
|
||||||
Properties getSystemProperties();
|
Properties getSystemProperties();
|
||||||
|
@ -211,7 +211,7 @@ public interface ModelBuildingRequest
|
||||||
/**
|
/**
|
||||||
* Sets the system properties to use for interpolation and profile activation. The system properties are collected
|
* Sets the system properties to use for interpolation and profile activation. The system properties are collected
|
||||||
* from the runtime environment like {@link System#getProperties()} and environment variables.
|
* from the runtime environment like {@link System#getProperties()} and environment variables.
|
||||||
*
|
*
|
||||||
* @param systemProperties The system properties, may be {@code null}.
|
* @param systemProperties The system properties, may be {@code null}.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@ -221,7 +221,7 @@ public interface ModelBuildingRequest
|
||||||
* Gets the user properties to use for interpolation and profile activation. The user properties have been
|
* Gets the user properties to use for interpolation and profile activation. The user properties have been
|
||||||
* configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
|
* configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
|
||||||
* line.
|
* line.
|
||||||
*
|
*
|
||||||
* @return The user properties, never {@code null}.
|
* @return The user properties, never {@code null}.
|
||||||
*/
|
*/
|
||||||
Properties getUserProperties();
|
Properties getUserProperties();
|
||||||
|
@ -230,7 +230,7 @@ public interface ModelBuildingRequest
|
||||||
* Sets the user properties to use for interpolation and profile activation. The user properties have been
|
* Sets the user properties to use for interpolation and profile activation. The user properties have been
|
||||||
* configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
|
* configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
|
||||||
* line.
|
* line.
|
||||||
*
|
*
|
||||||
* @param userProperties The user properties, may be {@code null}.
|
* @param userProperties The user properties, may be {@code null}.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@ -238,14 +238,14 @@ public interface ModelBuildingRequest
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the start time of the build.
|
* Gets the start time of the build.
|
||||||
*
|
*
|
||||||
* @return The start time of the build or {@code null} if unknown.
|
* @return The start time of the build or {@code null} if unknown.
|
||||||
*/
|
*/
|
||||||
Date getBuildStartTime();
|
Date getBuildStartTime();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the start time of the build.
|
* Sets the start time of the build.
|
||||||
*
|
*
|
||||||
* @param buildStartTime The start time of the build, may be {@code null}.
|
* @param buildStartTime The start time of the build, may be {@code null}.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@ -254,7 +254,7 @@ public interface ModelBuildingRequest
|
||||||
/**
|
/**
|
||||||
* Gets the model resolver to use for resolution of mixins or parents that are not locally reachable from the
|
* Gets the model resolver to use for resolution of mixins or parents that are not locally reachable from the
|
||||||
* project directory.
|
* project directory.
|
||||||
*
|
*
|
||||||
* @return The model resolver or {@code null} if not set.
|
* @return The model resolver or {@code null} if not set.
|
||||||
*/
|
*/
|
||||||
ModelResolver getModelResolver();
|
ModelResolver getModelResolver();
|
||||||
|
@ -262,7 +262,7 @@ public interface ModelBuildingRequest
|
||||||
/**
|
/**
|
||||||
* Sets the model resolver to use for resolution of mixins or parents that are not locally reachable from the
|
* Sets the model resolver to use for resolution of mixins or parents that are not locally reachable from the
|
||||||
* project directory.
|
* project directory.
|
||||||
*
|
*
|
||||||
* @param modelResolver The model resolver to use, may be {@code null}.
|
* @param modelResolver The model resolver to use, may be {@code null}.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@ -270,14 +270,14 @@ public interface ModelBuildingRequest
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the model building listener to notify during the build process.
|
* Gets the model building listener to notify during the build process.
|
||||||
*
|
*
|
||||||
* @return The model building listener to notify or {@code null} if none.
|
* @return The model building listener to notify or {@code null} if none.
|
||||||
*/
|
*/
|
||||||
ModelBuildingListener getModelBuildingListener();
|
ModelBuildingListener getModelBuildingListener();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the model building listener to notify during the build process.
|
* Sets the model building listener to notify during the build process.
|
||||||
*
|
*
|
||||||
* @param modelBuildingListener The model building listener to notify, may be {@code null}.
|
* @param modelBuildingListener The model building listener to notify, may be {@code null}.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@ -285,7 +285,7 @@ public interface ModelBuildingRequest
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the model cache to use for reuse of previously built models.
|
* Gets the model cache to use for reuse of previously built models.
|
||||||
*
|
*
|
||||||
* @return The model cache or {@code null} if not set.
|
* @return The model cache or {@code null} if not set.
|
||||||
*/
|
*/
|
||||||
ModelCache getModelCache();
|
ModelCache getModelCache();
|
||||||
|
@ -293,7 +293,7 @@ public interface ModelBuildingRequest
|
||||||
/**
|
/**
|
||||||
* Sets the model cache to use for reuse of previously built models. This is an optional component that serves
|
* Sets the model cache to use for reuse of previously built models. This is an optional component that serves
|
||||||
* performance optimizations.
|
* performance optimizations.
|
||||||
*
|
*
|
||||||
* @param modelCache The model cache to use, may be {@code null}.
|
* @param modelCache The model cache to use, may be {@code null}.
|
||||||
* @return This request, never {@code null}.
|
* @return This request, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.maven.model.Model;
|
||||||
/**
|
/**
|
||||||
* Describes a tag used by the model builder to access a {@link ModelCache}. This interface basically aggregates a name
|
* Describes a tag used by the model builder to access a {@link ModelCache}. This interface basically aggregates a name
|
||||||
* and a class to provide some type safety when working with the otherwise untyped cache.
|
* and a class to provide some type safety when working with the otherwise untyped cache.
|
||||||
*
|
*
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @param <T> The type of data associated with the tag.
|
* @param <T> The type of data associated with the tag.
|
||||||
*/
|
*/
|
||||||
|
@ -34,14 +34,14 @@ interface ModelCacheTag<T>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name of the tag.
|
* Gets the name of the tag.
|
||||||
*
|
*
|
||||||
* @return The name of the tag, must not be {@code null}.
|
* @return The name of the tag, must not be {@code null}.
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type of data associated with this tag.
|
* Gets the type of data associated with this tag.
|
||||||
*
|
*
|
||||||
* @return The type of data, must not be {@code null}.
|
* @return The type of data, must not be {@code null}.
|
||||||
*/
|
*/
|
||||||
Class<T> getType();
|
Class<T> getType();
|
||||||
|
@ -49,7 +49,7 @@ interface ModelCacheTag<T>
|
||||||
/**
|
/**
|
||||||
* Creates a copy of the data suitable for storage in the cache. The original data to store can be mutated after the
|
* Creates a copy of the data suitable for storage in the cache. The original data to store can be mutated after the
|
||||||
* cache is populated but the state of the cache must not change so we need to make a copy.
|
* cache is populated but the state of the cache must not change so we need to make a copy.
|
||||||
*
|
*
|
||||||
* @param data The data to store in the cache, must not be {@code null}.
|
* @param data The data to store in the cache, must not be {@code null}.
|
||||||
* @return The data being stored in the cache, never {@code null}.
|
* @return The data being stored in the cache, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@ -58,7 +58,7 @@ interface ModelCacheTag<T>
|
||||||
/**
|
/**
|
||||||
* Creates a copy of the data suitable for retrieval from the cache. The retrieved data can be mutated after the
|
* Creates a copy of the data suitable for retrieval from the cache. The retrieved data can be mutated after the
|
||||||
* cache is queried but the state of the cache must not change so we need to make a copy.
|
* cache is queried but the state of the cache must not change so we need to make a copy.
|
||||||
*
|
*
|
||||||
* @param data The data to retrieve from the cache, must not be {@code null}.
|
* @param data The data to retrieve from the cache, must not be {@code null}.
|
||||||
* @return The data being retrieved from the cache, never {@code null}.
|
* @return The data being retrieved from the cache, never {@code null}.
|
||||||
*/
|
*/
|
||||||
|
@ -67,7 +67,7 @@ interface ModelCacheTag<T>
|
||||||
/**
|
/**
|
||||||
* The tag used to denote raw model data.
|
* The tag used to denote raw model data.
|
||||||
*/
|
*/
|
||||||
public static final ModelCacheTag<ModelData> RAW = new ModelCacheTag<ModelData>()
|
ModelCacheTag<ModelData> RAW = new ModelCacheTag<ModelData>()
|
||||||
{
|
{
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
|
@ -96,7 +96,7 @@ interface ModelCacheTag<T>
|
||||||
/**
|
/**
|
||||||
* The tag used to denote an effective dependency management section from an imported model.
|
* The tag used to denote an effective dependency management section from an imported model.
|
||||||
*/
|
*/
|
||||||
public static final ModelCacheTag<DependencyManagement> IMPORT = new ModelCacheTag<DependencyManagement>()
|
ModelCacheTag<DependencyManagement> IMPORT = new ModelCacheTag<DependencyManagement>()
|
||||||
{
|
{
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
|
|
|
@ -1,11 +1,30 @@
|
||||||
package org.apache.maven.model.building;
|
package org.apache.maven.model.building;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
|
|
||||||
|
|
||||||
public interface ModelEventListener {
|
public interface ModelEventListener
|
||||||
|
{
|
||||||
|
|
||||||
|
void fire( Model model );
|
||||||
|
|
||||||
void fire(Model model);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles inheritance of model values.
|
* Handles inheritance of model values.
|
||||||
*
|
*
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
*/
|
*/
|
||||||
@Component( role = InheritanceAssembler.class )
|
@Component( role = InheritanceAssembler.class )
|
||||||
|
@ -64,7 +64,7 @@ public class DefaultInheritanceAssembler
|
||||||
* point at the POM rather than its base directory if the path ends with ".xml" (ignoring case). The name of the
|
* point at the POM rather than its base directory if the path ends with ".xml" (ignoring case). The name of the
|
||||||
* child's base directory matches the artifact id of the child. Note that for the sake of independence from the user
|
* child's base directory matches the artifact id of the child. Note that for the sake of independence from the user
|
||||||
* environment, the filesystem is intentionally not used for the calculation.
|
* environment, the filesystem is intentionally not used for the calculation.
|
||||||
*
|
*
|
||||||
* @param child The child model, must not be <code>null</code>.
|
* @param child The child model, must not be <code>null</code>.
|
||||||
* @param parent The parent model, may be <code>null</code>.
|
* @param parent The parent model, may be <code>null</code>.
|
||||||
* @return The path adjustment, can be empty but never <code>null</code>.
|
* @return The path adjustment, can be empty but never <code>null</code>.
|
||||||
|
@ -121,9 +121,8 @@ public class DefaultInheritanceAssembler
|
||||||
List<Plugin> tgt = target.getPlugins();
|
List<Plugin> tgt = target.getPlugins();
|
||||||
Map<Object, Plugin> merged = new LinkedHashMap<Object, Plugin>( ( src.size() + tgt.size() ) * 2 );
|
Map<Object, Plugin> merged = new LinkedHashMap<Object, Plugin>( ( src.size() + tgt.size() ) * 2 );
|
||||||
|
|
||||||
for ( Iterator<Plugin> it = src.iterator(); it.hasNext(); )
|
for ( Plugin element : src )
|
||||||
{
|
{
|
||||||
Plugin element = it.next();
|
|
||||||
Object key = getPluginKey( element );
|
Object key = getPluginKey( element );
|
||||||
if ( element.isInherited() )
|
if ( element.isInherited() )
|
||||||
{
|
{
|
||||||
|
@ -137,9 +136,8 @@ public class DefaultInheritanceAssembler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Iterator<Plugin> it = tgt.iterator(); it.hasNext(); )
|
for ( Plugin element : tgt )
|
||||||
{
|
{
|
||||||
Plugin element = it.next();
|
|
||||||
Object key = getPluginKey( element );
|
Object key = getPluginKey( element );
|
||||||
Plugin existing = merged.get( key );
|
Plugin existing = merged.get( key );
|
||||||
if ( existing != null )
|
if ( existing != null )
|
||||||
|
@ -164,9 +162,8 @@ public class DefaultInheritanceAssembler
|
||||||
Map<Object, ReportPlugin> merged =
|
Map<Object, ReportPlugin> merged =
|
||||||
new LinkedHashMap<Object, ReportPlugin>( ( src.size() + tgt.size() ) * 2 );
|
new LinkedHashMap<Object, ReportPlugin>( ( src.size() + tgt.size() ) * 2 );
|
||||||
|
|
||||||
for ( Iterator<ReportPlugin> it = src.iterator(); it.hasNext(); )
|
for ( ReportPlugin element : src )
|
||||||
{
|
{
|
||||||
ReportPlugin element = it.next();
|
|
||||||
Object key = getReportPluginKey( element );
|
Object key = getReportPluginKey( element );
|
||||||
if ( element.isInherited() )
|
if ( element.isInherited() )
|
||||||
{
|
{
|
||||||
|
@ -180,9 +177,8 @@ public class DefaultInheritanceAssembler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Iterator<ReportPlugin> it = tgt.iterator(); it.hasNext(); )
|
for ( ReportPlugin element : tgt )
|
||||||
{
|
{
|
||||||
ReportPlugin element = it.next();
|
|
||||||
Object key = getReportPluginKey( element );
|
Object key = getReportPluginKey( element );
|
||||||
ReportPlugin existing = merged.get( key );
|
ReportPlugin existing = merged.get( key );
|
||||||
if ( existing != null )
|
if ( existing != null )
|
||||||
|
|
|
@ -93,11 +93,11 @@ public abstract class AbstractStringBasedModelInterpolator
|
||||||
|
|
||||||
@Requirement
|
@Requirement
|
||||||
private PathTranslator pathTranslator;
|
private PathTranslator pathTranslator;
|
||||||
|
|
||||||
private Interpolator interpolator;
|
private Interpolator interpolator;
|
||||||
|
|
||||||
private RecursionInterceptor recursionInterceptor;
|
private RecursionInterceptor recursionInterceptor;
|
||||||
|
|
||||||
public AbstractStringBasedModelInterpolator()
|
public AbstractStringBasedModelInterpolator()
|
||||||
{
|
{
|
||||||
interpolator = createInterpolator();
|
interpolator = createInterpolator();
|
||||||
|
@ -170,7 +170,7 @@ public abstract class AbstractStringBasedModelInterpolator
|
||||||
|
|
||||||
return valueSources;
|
return valueSources;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<? extends InterpolationPostProcessor> createPostProcessors( final Model model,
|
protected List<? extends InterpolationPostProcessor> createPostProcessors( final Model model,
|
||||||
final File projectDir,
|
final File projectDir,
|
||||||
final ModelBuildingRequest config )
|
final ModelBuildingRequest config )
|
||||||
|
@ -186,7 +186,7 @@ public abstract class AbstractStringBasedModelInterpolator
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String interpolateInternal( String src, List<? extends ValueSource> valueSources,
|
protected String interpolateInternal( String src, List<? extends ValueSource> valueSources,
|
||||||
List<? extends InterpolationPostProcessor> postProcessors,
|
List<? extends InterpolationPostProcessor> postProcessors,
|
||||||
ModelProblemCollector problems )
|
ModelProblemCollector problems )
|
||||||
|
@ -197,14 +197,14 @@ public abstract class AbstractStringBasedModelInterpolator
|
||||||
}
|
}
|
||||||
|
|
||||||
String result = src;
|
String result = src;
|
||||||
synchronized( this )
|
synchronized ( this )
|
||||||
{
|
{
|
||||||
|
|
||||||
for ( ValueSource vs : valueSources )
|
for ( ValueSource vs : valueSources )
|
||||||
{
|
{
|
||||||
interpolator.addValueSource( vs );
|
interpolator.addValueSource( vs );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( InterpolationPostProcessor postProcessor : postProcessors )
|
for ( InterpolationPostProcessor postProcessor : postProcessors )
|
||||||
{
|
{
|
||||||
interpolator.addPostProcessor( postProcessor );
|
interpolator.addPostProcessor( postProcessor );
|
||||||
|
@ -229,7 +229,7 @@ public abstract class AbstractStringBasedModelInterpolator
|
||||||
{
|
{
|
||||||
interpolator.removeValuesSource( vs );
|
interpolator.removeValuesSource( vs );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( InterpolationPostProcessor postProcessor : postProcessors )
|
for ( InterpolationPostProcessor postProcessor : postProcessors )
|
||||||
{
|
{
|
||||||
interpolator.removePostProcessor( postProcessor );
|
interpolator.removePostProcessor( postProcessor );
|
||||||
|
@ -239,7 +239,7 @@ public abstract class AbstractStringBasedModelInterpolator
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RecursionInterceptor getRecursionInterceptor()
|
protected RecursionInterceptor getRecursionInterceptor()
|
||||||
{
|
{
|
||||||
return recursionInterceptor;
|
return recursionInterceptor;
|
||||||
|
@ -251,7 +251,7 @@ public abstract class AbstractStringBasedModelInterpolator
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Interpolator createInterpolator();
|
protected abstract Interpolator createInterpolator();
|
||||||
|
|
||||||
protected final Interpolator getInterpolator()
|
protected final Interpolator getInterpolator()
|
||||||
{
|
{
|
||||||
return interpolator;
|
return interpolator;
|
||||||
|
|
|
@ -52,20 +52,20 @@ public class StringSearchModelInterpolator
|
||||||
ModelProblemCollector problems )
|
ModelProblemCollector problems )
|
||||||
{
|
{
|
||||||
interpolateObject( model, model, projectDir, config, problems );
|
interpolateObject( model, model, projectDir, config, problems );
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void interpolateObject( Object obj, Model model, File projectDir, ModelBuildingRequest config, ModelProblemCollector problems )
|
protected void interpolateObject( Object obj, Model model, File projectDir, ModelBuildingRequest config, ModelProblemCollector problems )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<? extends ValueSource> valueSources = createValueSources( model, projectDir, config );
|
List<? extends ValueSource> valueSources = createValueSources( model, projectDir, config );
|
||||||
List<? extends InterpolationPostProcessor> postProcessors = createPostProcessors( model, projectDir, config );
|
List<? extends InterpolationPostProcessor> postProcessors = createPostProcessors( model, projectDir, config );
|
||||||
|
|
||||||
InterpolateObjectAction action =
|
InterpolateObjectAction action =
|
||||||
new InterpolateObjectAction( obj, valueSources, postProcessors, this, problems );
|
new InterpolateObjectAction( obj, valueSources, postProcessors, this, problems );
|
||||||
|
|
||||||
AccessController.doPrivileged( action );
|
AccessController.doPrivileged( action );
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -78,10 +78,10 @@ public class StringSearchModelInterpolator
|
||||||
{
|
{
|
||||||
StringSearchInterpolator interpolator = new StringSearchInterpolator();
|
StringSearchInterpolator interpolator = new StringSearchInterpolator();
|
||||||
interpolator.setCacheAnswers( true );
|
interpolator.setCacheAnswers( true );
|
||||||
|
|
||||||
return interpolator;
|
return interpolator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class InterpolateObjectAction implements PrivilegedAction<Object>
|
private static final class InterpolateObjectAction implements PrivilegedAction<Object>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -90,17 +90,17 @@ public class StringSearchModelInterpolator
|
||||||
private final List<? extends ValueSource> valueSources;
|
private final List<? extends ValueSource> valueSources;
|
||||||
private final List<? extends InterpolationPostProcessor> postProcessors;
|
private final List<? extends InterpolationPostProcessor> postProcessors;
|
||||||
private final ModelProblemCollector problems;
|
private final ModelProblemCollector problems;
|
||||||
|
|
||||||
public InterpolateObjectAction( Object target, List<? extends ValueSource> valueSources,
|
public InterpolateObjectAction( Object target, List<? extends ValueSource> valueSources,
|
||||||
List<? extends InterpolationPostProcessor> postProcessors,
|
List<? extends InterpolationPostProcessor> postProcessors,
|
||||||
StringSearchModelInterpolator modelInterpolator, ModelProblemCollector problems )
|
StringSearchModelInterpolator modelInterpolator, ModelProblemCollector problems )
|
||||||
{
|
{
|
||||||
this.valueSources = valueSources;
|
this.valueSources = valueSources;
|
||||||
this.postProcessors = postProcessors;
|
this.postProcessors = postProcessors;
|
||||||
|
|
||||||
this.interpolationTargets = new LinkedList<Object>();
|
this.interpolationTargets = new LinkedList<Object>();
|
||||||
interpolationTargets.add( target );
|
interpolationTargets.add( target );
|
||||||
|
|
||||||
this.modelInterpolator = modelInterpolator;
|
this.modelInterpolator = modelInterpolator;
|
||||||
|
|
||||||
this.problems = problems;
|
this.problems = problems;
|
||||||
|
@ -108,13 +108,13 @@ public class StringSearchModelInterpolator
|
||||||
|
|
||||||
public Object run()
|
public Object run()
|
||||||
{
|
{
|
||||||
while( !interpolationTargets.isEmpty() )
|
while ( !interpolationTargets.isEmpty() )
|
||||||
{
|
{
|
||||||
Object obj = interpolationTargets.removeFirst();
|
Object obj = interpolationTargets.removeFirst();
|
||||||
|
|
||||||
traverseObjectWithParents( obj.getClass(), obj );
|
traverseObjectWithParents( obj.getClass(), obj );
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,8 +125,8 @@ public class StringSearchModelInterpolator
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( cls.isArray() )
|
if ( cls.isArray() )
|
||||||
{
|
{
|
||||||
evaluateArray( target );
|
evaluateArray( target );
|
||||||
|
@ -139,7 +139,7 @@ public class StringSearchModelInterpolator
|
||||||
fields = cls.getDeclaredFields();
|
fields = cls.getDeclaredFields();
|
||||||
fieldsByClass.put( cls, fields );
|
fieldsByClass.put( cls, fields );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( int i = 0; i < fields.length; i++ )
|
for ( int i = 0; i < fields.length; i++ )
|
||||||
{
|
{
|
||||||
Class<?> type = fields[i].getType();
|
Class<?> type = fields[i].getType();
|
||||||
|
@ -159,7 +159,7 @@ public class StringSearchModelInterpolator
|
||||||
String interpolated =
|
String interpolated =
|
||||||
modelInterpolator.interpolateInternal( value, valueSources, postProcessors,
|
modelInterpolator.interpolateInternal( value, valueSources, postProcessors,
|
||||||
problems );
|
problems );
|
||||||
|
|
||||||
if ( !interpolated.equals( value ) )
|
if ( !interpolated.equals( value ) )
|
||||||
{
|
{
|
||||||
fields[i].set( target, interpolated );
|
fields[i].set( target, interpolated );
|
||||||
|
@ -176,22 +176,22 @@ public class StringSearchModelInterpolator
|
||||||
{
|
{
|
||||||
c.clear();
|
c.clear();
|
||||||
}
|
}
|
||||||
catch( UnsupportedOperationException e )
|
catch ( UnsupportedOperationException e )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Object value : originalValues )
|
for ( Object value : originalValues )
|
||||||
{
|
{
|
||||||
if ( value != null )
|
if ( value != null )
|
||||||
{
|
{
|
||||||
if( String.class == value.getClass() )
|
if ( String.class == value.getClass() )
|
||||||
{
|
{
|
||||||
String interpolated =
|
String interpolated =
|
||||||
modelInterpolator.interpolateInternal( (String) value,
|
modelInterpolator.interpolateInternal( (String) value,
|
||||||
valueSources,
|
valueSources,
|
||||||
postProcessors, problems );
|
postProcessors, problems );
|
||||||
|
|
||||||
if ( !interpolated.equals( value ) )
|
if ( !interpolated.equals( value ) )
|
||||||
{
|
{
|
||||||
c.add( interpolated );
|
c.add( interpolated );
|
||||||
|
@ -230,23 +230,23 @@ public class StringSearchModelInterpolator
|
||||||
for ( Map.Entry<Object, Object> entry : m.entrySet() )
|
for ( Map.Entry<Object, Object> entry : m.entrySet() )
|
||||||
{
|
{
|
||||||
Object value = entry.getValue();
|
Object value = entry.getValue();
|
||||||
|
|
||||||
if ( value != null )
|
if ( value != null )
|
||||||
{
|
{
|
||||||
if( String.class == value.getClass() )
|
if ( String.class == value.getClass() )
|
||||||
{
|
{
|
||||||
String interpolated =
|
String interpolated =
|
||||||
modelInterpolator.interpolateInternal( (String) value,
|
modelInterpolator.interpolateInternal( (String) value,
|
||||||
valueSources,
|
valueSources,
|
||||||
postProcessors, problems );
|
postProcessors, problems );
|
||||||
|
|
||||||
if ( !interpolated.equals( value ) )
|
if ( !interpolated.equals( value ) )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
entry.setValue( interpolated );
|
entry.setValue( interpolated );
|
||||||
}
|
}
|
||||||
catch( UnsupportedOperationException e )
|
catch ( UnsupportedOperationException e )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ public class StringSearchModelInterpolator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
traverseObjectWithParents( cls.getSuperclass(), target );
|
traverseObjectWithParents( cls.getSuperclass(), target );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -316,29 +316,29 @@ public class StringSearchModelInterpolator
|
||||||
{
|
{
|
||||||
fieldIsPrimitiveByClass.put( fieldType, Boolean.valueOf( fieldType.isPrimitive() ) );
|
fieldIsPrimitiveByClass.put( fieldType, Boolean.valueOf( fieldType.isPrimitive() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fieldIsPrimitiveByClass.get( fieldType ).booleanValue() )
|
if ( fieldIsPrimitiveByClass.get( fieldType ).booleanValue() )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ( fieldType.isPrimitive() )
|
// if ( fieldType.isPrimitive() )
|
||||||
// {
|
// {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if ( "parent".equals( field.getName() ) )
|
if ( "parent".equals( field.getName() ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void evaluateArray( Object target )
|
private void evaluateArray( Object target )
|
||||||
{
|
{
|
||||||
int len = Array.getLength( target );
|
int len = Array.getLength( target );
|
||||||
for( int i = 0; i < len; i++ )
|
for ( int i = 0; i < len; i++ )
|
||||||
{
|
{
|
||||||
Object value = Array.get( target, i );
|
Object value = Array.get( target, i );
|
||||||
if ( value != null )
|
if ( value != null )
|
||||||
|
@ -348,7 +348,7 @@ public class StringSearchModelInterpolator
|
||||||
String interpolated =
|
String interpolated =
|
||||||
modelInterpolator.interpolateInternal( (String) value, valueSources, postProcessors,
|
modelInterpolator.interpolateInternal( (String) value, valueSources, postProcessors,
|
||||||
problems );
|
problems );
|
||||||
|
|
||||||
if ( !interpolated.equals( value ) )
|
if ( !interpolated.equals( value ) )
|
||||||
{
|
{
|
||||||
Array.set( target, i, interpolated );
|
Array.set( target, i, interpolated );
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.maven.model.Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles deserialization of a model from some kind of textual format like XML.
|
* Handles deserialization of a model from some kind of textual format like XML.
|
||||||
*
|
*
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
*/
|
*/
|
||||||
public interface ModelReader
|
public interface ModelReader
|
||||||
|
@ -39,11 +39,11 @@ public interface ModelReader
|
||||||
* The key for the option to enable strict parsing. This option is of type {@link Boolean} and defaults to {@code
|
* The key for the option to enable strict parsing. This option is of type {@link Boolean} and defaults to {@code
|
||||||
* true}. If {@code false}, unknown elements will be ignored instead of causing a failure.
|
* true}. If {@code false}, unknown elements will be ignored instead of causing a failure.
|
||||||
*/
|
*/
|
||||||
static final String IS_STRICT = "org.apache.maven.model.io.isStrict";
|
String IS_STRICT = "org.apache.maven.model.io.isStrict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the model from the specified file.
|
* Reads the model from the specified file.
|
||||||
*
|
*
|
||||||
* @param input The file to deserialize the model from, must not be {@code null}.
|
* @param input The file to deserialize the model from, must not be {@code null}.
|
||||||
* @param options The options to use for deserialization, may be {@code null} to use the default values.
|
* @param options The options to use for deserialization, may be {@code null} to use the default values.
|
||||||
* @return The deserialized model, never {@code null}.
|
* @return The deserialized model, never {@code null}.
|
||||||
|
@ -56,7 +56,7 @@ public interface ModelReader
|
||||||
/**
|
/**
|
||||||
* Reads the model from the specified character reader. The reader will be automatically closed before the method
|
* Reads the model from the specified character reader. The reader will be automatically closed before the method
|
||||||
* returns.
|
* returns.
|
||||||
*
|
*
|
||||||
* @param input The reader to deserialize the model from, must not be {@code null}.
|
* @param input The reader to deserialize the model from, must not be {@code null}.
|
||||||
* @param options The options to use for deserialization, may be {@code null} to use the default values.
|
* @param options The options to use for deserialization, may be {@code null} to use the default values.
|
||||||
* @return The deserialized model, never {@code null}.
|
* @return The deserialized model, never {@code null}.
|
||||||
|
@ -69,7 +69,7 @@ public interface ModelReader
|
||||||
/**
|
/**
|
||||||
* Reads the model from the specified byte stream. The stream will be automatically closed before the method
|
* Reads the model from the specified byte stream. The stream will be automatically closed before the method
|
||||||
* returns.
|
* returns.
|
||||||
*
|
*
|
||||||
* @param input The stream to deserialize the model from, must not be {@code null}.
|
* @param input The stream to deserialize the model from, must not be {@code null}.
|
||||||
* @param options The options to use for deserialization, may be {@code null} to use the default values.
|
* @param options The options to use for deserialization, may be {@code null} to use the default values.
|
||||||
* @return The deserialized model, never {@code null}.
|
* @return The deserialized model, never {@code null}.
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.maven.model.management;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -36,7 +35,7 @@ import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles injection of dependency management into the model.
|
* Handles injection of dependency management into the model.
|
||||||
*
|
*
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
*/
|
*/
|
||||||
@Component( role = DependencyManagementInjector.class )
|
@Component( role = DependencyManagementInjector.class )
|
||||||
|
@ -90,9 +89,8 @@ public class DefaultDependencyManagementInjector
|
||||||
{
|
{
|
||||||
List<Exclusion> src = source.getExclusions();
|
List<Exclusion> src = source.getExclusions();
|
||||||
|
|
||||||
for ( Iterator<Exclusion> it = src.iterator(); it.hasNext(); )
|
for ( Exclusion element : src )
|
||||||
{
|
{
|
||||||
Exclusion element = it.next();
|
|
||||||
Exclusion clone = new Exclusion();
|
Exclusion clone = new Exclusion();
|
||||||
mergeExclusion( clone, element, true, context );
|
mergeExclusion( clone, element, true, context );
|
||||||
target.addExclusion( clone );
|
target.addExclusion( clone );
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.maven.model.management;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -39,7 +38,7 @@ import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles injection of plugin management into the model.
|
* Handles injection of plugin management into the model.
|
||||||
*
|
*
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
*/
|
*/
|
||||||
@Component( role = PluginManagementInjector.class )
|
@Component( role = PluginManagementInjector.class )
|
||||||
|
@ -82,16 +81,14 @@ public class DefaultPluginManagementInjector
|
||||||
|
|
||||||
Map<Object, Object> context = Collections.emptyMap();
|
Map<Object, Object> context = Collections.emptyMap();
|
||||||
|
|
||||||
for ( Iterator<Plugin> it = src.iterator(); it.hasNext(); )
|
for ( Plugin element : src )
|
||||||
{
|
{
|
||||||
Plugin element = it.next();
|
|
||||||
Object key = getPluginKey( element );
|
Object key = getPluginKey( element );
|
||||||
managedPlugins.put( key, element );
|
managedPlugins.put( key, element );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Iterator<Plugin> it = tgt.iterator(); it.hasNext(); )
|
for ( Plugin element : tgt )
|
||||||
{
|
{
|
||||||
Plugin element = it.next();
|
|
||||||
Object key = getPluginKey( element );
|
Object key = getPluginKey( element );
|
||||||
Plugin managedPlugin = managedPlugins.get( key );
|
Plugin managedPlugin = managedPlugins.get( key );
|
||||||
if ( managedPlugin != null )
|
if ( managedPlugin != null )
|
||||||
|
@ -114,18 +111,16 @@ public class DefaultPluginManagementInjector
|
||||||
Map<Object, PluginExecution> merged =
|
Map<Object, PluginExecution> merged =
|
||||||
new LinkedHashMap<Object, PluginExecution>( ( src.size() + tgt.size() ) * 2 );
|
new LinkedHashMap<Object, PluginExecution>( ( src.size() + tgt.size() ) * 2 );
|
||||||
|
|
||||||
for ( Iterator<PluginExecution> it = src.iterator(); it.hasNext(); )
|
for ( PluginExecution element : src )
|
||||||
{
|
{
|
||||||
PluginExecution element = it.next();
|
|
||||||
Object key = getPluginExecutionKey( element );
|
Object key = getPluginExecutionKey( element );
|
||||||
PluginExecution clone = new PluginExecution();
|
PluginExecution clone = new PluginExecution();
|
||||||
mergePluginExecution( clone, element, true, context );
|
mergePluginExecution( clone, element, true, context );
|
||||||
merged.put( key, clone );
|
merged.put( key, clone );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Iterator<PluginExecution> it = tgt.iterator(); it.hasNext(); )
|
for ( PluginExecution element : tgt )
|
||||||
{
|
{
|
||||||
PluginExecution element = it.next();
|
|
||||||
Object key = getPluginExecutionKey( element );
|
Object key = getPluginExecutionKey( element );
|
||||||
PluginExecution existing = merged.get( key );
|
PluginExecution existing = merged.get( key );
|
||||||
if ( existing != null )
|
if ( existing != null )
|
||||||
|
|
|
@ -54,7 +54,7 @@ import org.apache.maven.model.Site;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The domain-specific model merger for the Maven POM.
|
* The domain-specific model merger for the Maven POM.
|
||||||
*
|
*
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
*/
|
*/
|
||||||
public class MavenModelMerger
|
public class MavenModelMerger
|
||||||
|
@ -78,7 +78,7 @@ public class MavenModelMerger
|
||||||
|
|
||||||
super.mergeModel( target, source, sourceDominant, context );
|
super.mergeModel( target, source, sourceDominant, context );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void mergeModel_Name( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
|
protected void mergeModel_Name( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
|
||||||
{
|
{
|
||||||
|
@ -124,7 +124,8 @@ public class MavenModelMerger
|
||||||
Organization tgt = target.getOrganization();
|
Organization tgt = target.getOrganization();
|
||||||
if ( tgt == null )
|
if ( tgt == null )
|
||||||
{
|
{
|
||||||
target.setOrganization( tgt = new Organization() );
|
tgt = new Organization();
|
||||||
|
target.setOrganization( tgt );
|
||||||
mergeOrganization( tgt, src, sourceDominant, context );
|
mergeOrganization( tgt, src, sourceDominant, context );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +141,8 @@ public class MavenModelMerger
|
||||||
IssueManagement tgt = target.getIssueManagement();
|
IssueManagement tgt = target.getIssueManagement();
|
||||||
if ( tgt == null )
|
if ( tgt == null )
|
||||||
{
|
{
|
||||||
target.setIssueManagement( tgt = new IssueManagement() );
|
tgt = new IssueManagement();
|
||||||
|
target.setIssueManagement( tgt );
|
||||||
mergeIssueManagement( tgt, src, sourceDominant, context );
|
mergeIssueManagement( tgt, src, sourceDominant, context );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,7 +158,8 @@ public class MavenModelMerger
|
||||||
CiManagement tgt = target.getCiManagement();
|
CiManagement tgt = target.getCiManagement();
|
||||||
if ( tgt == null )
|
if ( tgt == null )
|
||||||
{
|
{
|
||||||
target.setCiManagement( tgt = new CiManagement() );
|
tgt = new CiManagement();
|
||||||
|
target.setCiManagement( tgt );
|
||||||
mergeCiManagement( tgt, src, sourceDominant, context );
|
mergeCiManagement( tgt, src, sourceDominant, context );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,16 +264,14 @@ public class MavenModelMerger
|
||||||
recessive = src;
|
recessive = src;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Iterator<Repository> it = dominant.iterator(); it.hasNext(); )
|
for ( Repository element : dominant )
|
||||||
{
|
{
|
||||||
Repository element = it.next();
|
|
||||||
Object key = getRepositoryKey( element );
|
Object key = getRepositoryKey( element );
|
||||||
merged.put( key, element );
|
merged.put( key, element );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Iterator<Repository> it = recessive.iterator(); it.hasNext(); )
|
for ( Repository element : recessive )
|
||||||
{
|
{
|
||||||
Repository element = it.next();
|
|
||||||
Object key = getRepositoryKey( element );
|
Object key = getRepositoryKey( element );
|
||||||
if ( !merged.containsKey( key ) )
|
if ( !merged.containsKey( key ) )
|
||||||
{
|
{
|
||||||
|
@ -338,7 +339,8 @@ public class MavenModelMerger
|
||||||
DeploymentRepository tgt = target.getRepository();
|
DeploymentRepository tgt = target.getRepository();
|
||||||
if ( tgt == null )
|
if ( tgt == null )
|
||||||
{
|
{
|
||||||
target.setRepository( tgt = new DeploymentRepository() );
|
tgt = new DeploymentRepository();
|
||||||
|
target.setRepository( tgt );
|
||||||
mergeDeploymentRepository( tgt, src, sourceDominant, context );
|
mergeDeploymentRepository( tgt, src, sourceDominant, context );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,7 +357,8 @@ public class MavenModelMerger
|
||||||
DeploymentRepository tgt = target.getSnapshotRepository();
|
DeploymentRepository tgt = target.getSnapshotRepository();
|
||||||
if ( tgt == null )
|
if ( tgt == null )
|
||||||
{
|
{
|
||||||
target.setSnapshotRepository( tgt = new DeploymentRepository() );
|
tgt = new DeploymentRepository();
|
||||||
|
target.setSnapshotRepository( tgt );
|
||||||
mergeDeploymentRepository( tgt, src, sourceDominant, context );
|
mergeDeploymentRepository( tgt, src, sourceDominant, context );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -371,7 +374,8 @@ public class MavenModelMerger
|
||||||
Site tgt = target.getSite();
|
Site tgt = target.getSite();
|
||||||
if ( tgt == null )
|
if ( tgt == null )
|
||||||
{
|
{
|
||||||
target.setSite( tgt = new Site() );
|
tgt = new Site();
|
||||||
|
target.setSite( tgt );
|
||||||
mergeSite( tgt, src, sourceDominant, context );
|
mergeSite( tgt, src, sourceDominant, context );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -461,9 +465,8 @@ public class MavenModelMerger
|
||||||
Map<Object, PluginExecution> merged =
|
Map<Object, PluginExecution> merged =
|
||||||
new LinkedHashMap<Object, PluginExecution>( ( src.size() + tgt.size() ) * 2 );
|
new LinkedHashMap<Object, PluginExecution>( ( src.size() + tgt.size() ) * 2 );
|
||||||
|
|
||||||
for ( Iterator<PluginExecution> it = src.iterator(); it.hasNext(); )
|
for ( PluginExecution element : src )
|
||||||
{
|
{
|
||||||
PluginExecution element = it.next();
|
|
||||||
if ( sourceDominant || ( source.isInherited() && element.isInherited() ) )
|
if ( sourceDominant || ( source.isInherited() && element.isInherited() ) )
|
||||||
{
|
{
|
||||||
Object key = getPluginExecutionKey( element );
|
Object key = getPluginExecutionKey( element );
|
||||||
|
@ -471,9 +474,8 @@ public class MavenModelMerger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Iterator<PluginExecution> it = tgt.iterator(); it.hasNext(); )
|
for ( PluginExecution element : tgt )
|
||||||
{
|
{
|
||||||
PluginExecution element = it.next();
|
|
||||||
Object key = getPluginExecutionKey( element );
|
Object key = getPluginExecutionKey( element );
|
||||||
PluginExecution existing = merged.get( key );
|
PluginExecution existing = merged.get( key );
|
||||||
if ( existing != null )
|
if ( existing != null )
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.maven.model.profile;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -42,7 +41,7 @@ import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles profile injection into the model.
|
* Handles profile injection into the model.
|
||||||
*
|
*
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
*/
|
*/
|
||||||
@Component( role = ProfileInjector.class )
|
@Component( role = ProfileInjector.class )
|
||||||
|
@ -94,16 +93,14 @@ public class DefaultProfileInjector
|
||||||
List<Plugin> tgt = target.getPlugins();
|
List<Plugin> tgt = target.getPlugins();
|
||||||
Map<Object, Plugin> merged = new LinkedHashMap<Object, Plugin>( ( src.size() + tgt.size() ) * 2 );
|
Map<Object, Plugin> merged = new LinkedHashMap<Object, Plugin>( ( src.size() + tgt.size() ) * 2 );
|
||||||
|
|
||||||
for ( Iterator<Plugin> it = tgt.iterator(); it.hasNext(); )
|
for ( Plugin element : tgt )
|
||||||
{
|
{
|
||||||
Plugin element = it.next();
|
|
||||||
Object key = getPluginKey( element );
|
Object key = getPluginKey( element );
|
||||||
merged.put( key, element );
|
merged.put( key, element );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Iterator<Plugin> it = src.iterator(); it.hasNext(); )
|
for ( Plugin element : src )
|
||||||
{
|
{
|
||||||
Plugin element = it.next();
|
|
||||||
Object key = getPluginKey( element );
|
Object key = getPluginKey( element );
|
||||||
Plugin existing = merged.get( key );
|
Plugin existing = merged.get( key );
|
||||||
if ( existing == null )
|
if ( existing == null )
|
||||||
|
@ -131,16 +128,14 @@ public class DefaultProfileInjector
|
||||||
Map<Object, ReportPlugin> merged =
|
Map<Object, ReportPlugin> merged =
|
||||||
new LinkedHashMap<Object, ReportPlugin>( ( src.size() + tgt.size() ) * 2 );
|
new LinkedHashMap<Object, ReportPlugin>( ( src.size() + tgt.size() ) * 2 );
|
||||||
|
|
||||||
for ( Iterator<ReportPlugin> it = tgt.iterator(); it.hasNext(); )
|
for ( ReportPlugin element : tgt )
|
||||||
{
|
{
|
||||||
ReportPlugin element = it.next();
|
|
||||||
Object key = getReportPluginKey( element );
|
Object key = getReportPluginKey( element );
|
||||||
merged.put( key, element );
|
merged.put( key, element );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Iterator<ReportPlugin> it = src.iterator(); it.hasNext(); )
|
for ( ReportPlugin element : src )
|
||||||
{
|
{
|
||||||
ReportPlugin element = it.next();
|
|
||||||
Object key = getReportPluginKey( element );
|
Object key = getReportPluginKey( element );
|
||||||
ReportPlugin existing = merged.get( key );
|
ReportPlugin existing = merged.get( key );
|
||||||
if ( existing == null )
|
if ( existing == null )
|
||||||
|
|
|
@ -121,15 +121,15 @@ public class DefaultModelValidator
|
||||||
|
|
||||||
if ( !model.getModules().isEmpty() && !"pom".equals( model.getPackaging() ) )
|
if ( !model.getModules().isEmpty() && !"pom".equals( model.getPackaging() ) )
|
||||||
{
|
{
|
||||||
addViolation( problems, false, "Packaging '" + model.getPackaging() + "' is invalid. Aggregator projects " +
|
addViolation( problems, false, "Packaging '" + model.getPackaging() + "' is invalid. Aggregator projects "
|
||||||
"require 'pom' as packaging." );
|
+ "require 'pom' as packaging." );
|
||||||
}
|
}
|
||||||
|
|
||||||
Parent parent = model.getParent();
|
Parent parent = model.getParent();
|
||||||
if ( parent != null )
|
if ( parent != null )
|
||||||
{
|
{
|
||||||
if ( parent.getGroupId().equals( model.getGroupId() ) &&
|
if ( parent.getGroupId().equals( model.getGroupId() )
|
||||||
parent.getArtifactId().equals( model.getArtifactId() ) )
|
&& parent.getArtifactId().equals( model.getArtifactId() ) )
|
||||||
{
|
{
|
||||||
addViolation( problems, false, "The parent element cannot have the same ID as the project." );
|
addViolation( problems, false, "The parent element cannot have the same ID as the project." );
|
||||||
}
|
}
|
||||||
|
@ -163,8 +163,8 @@ public class DefaultModelValidator
|
||||||
{
|
{
|
||||||
if ( !new File( systemPath ).isAbsolute() )
|
if ( !new File( systemPath ).isAbsolute() )
|
||||||
{
|
{
|
||||||
addViolation( problems, false, "For dependency " + d + ": system-scoped dependency must " +
|
addViolation( problems, false, "For dependency " + d + ": system-scoped dependency must "
|
||||||
"specify an absolute path systemPath." );
|
+ "specify an absolute path systemPath." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,8 +208,8 @@ public class DefaultModelValidator
|
||||||
{
|
{
|
||||||
if ( !new File( systemPath ).isAbsolute() )
|
if ( !new File( systemPath ).isAbsolute() )
|
||||||
{
|
{
|
||||||
addViolation( problems, false, "For managed dependency " + d + ": system-scoped dependency must " +
|
addViolation( problems, false, "For managed dependency " + d + ": system-scoped dependency must "
|
||||||
"specify an absolute path systemPath." );
|
+ "specify an absolute path systemPath." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue