Class PluginPropertyUtils
java.lang.Object
org.netbeans.modules.maven.api.PluginPropertyUtils
Examines a POM for configuration of plugins.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
builder responsible for converting Xpp3Dom from Maven to custom object trees.static final class
Query parameters to convert property containing a dependency list into artifact list. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator
createEvaluator
(org.apache.maven.project.MavenProject prj) Evaluator usable for interpolating variables in non resolved (interpolated) models.static org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator
createEvaluator
(org.netbeans.api.project.Project project) Evaluator usable for interpolating variables in non resolved (interpolated) models.static List
<org.apache.maven.artifact.Artifact> getPluginPathProperty
(org.netbeans.api.project.Project project, PluginPropertyUtils.PluginConfigPathParams query, boolean transitiveDependencies, List<org.apache.maven.artifact.resolver.ArtifactResolutionException> errorsOpt) Converts a list of dependency declarations in the plugin configuration into list of Artifacts.static String
getPluginProperty
(org.apache.maven.project.MavenProject prj, String groupId, String artifactId, String parameter, String goal) Deprecated.use the variant with expressionProperty valuestatic String
getPluginProperty
(org.apache.maven.project.MavenProject prj, String groupId, String artifactId, String parameter, String goal, String expressionProperty) tries to figure out if the property of the given plugin is customized in the current project and returns it's value if so, otherwise nullstatic String
getPluginProperty
(org.netbeans.api.project.Project prj, String groupId, String artifactId, String parameter, String goal) Deprecated.use the variant with expressionProperty valuestatic String
getPluginProperty
(org.netbeans.api.project.Project prj, String groupId, String artifactId, String parameter, String goal, String expressionProperty) tries to figure out if the property of the given plugin is customized in the current project and returns it's value if so, otherwise nullstatic <T> T
getPluginPropertyBuildable
(org.apache.maven.project.MavenProject prj, String groupId, String artifactId, String goal, PluginPropertyUtils.ConfigurationBuilder<T> builder) tries to figure out if the property of the given plugin is customized in the current project and returns it's value if so, otherwise nullstatic <T> T
getPluginPropertyBuildable
(org.netbeans.api.project.Project prj, String groupId, String artifactId, String goal, PluginPropertyUtils.ConfigurationBuilder<T> builder) tries to figure out if the property of the given plugin is customized in the current project and returns it's value if so, otherwise nullstatic String[]
getPluginPropertyList
(org.apache.maven.project.MavenProject prj, String groupId, String artifactId, String multiproperty, String singleproperty, String goal) gets the list of values for the given property, if configured in the current project.static String[]
getPluginPropertyList
(org.netbeans.api.project.Project prj, String groupId, String artifactId, String multiproperty, String singleproperty, String goal) gets the list of values for the given property, if configured in the current project.static Properties
getPluginPropertyParameter
(org.apache.maven.project.MavenProject prj, String groupId, String artifactId, String propertyParameter, String goal) Loads name/value pairs from plugin configuration.static Properties
getPluginPropertyParameter
(org.netbeans.api.project.Project prj, String groupId, String artifactId, String propertyParameter, String goal) Loads name/value pairs from plugin configuration.static String
getPluginVersion
(org.apache.maven.project.MavenProject prj, String groupId, String artifactId) tries to figure out if the a plugin is defined in the project and return the version declared.static String
getReportPluginProperty
(org.apache.maven.project.MavenProject prj, String groupId, String artifactId, String property, String report) tries to figure out if the property of the given report plugin is customized in the current project and returns it's value if so, otherwise null Please NOTE that if you have access toProject
instance and yourMavenProject
is the project's own loaded one, then the variant withProject
as parameter is preferable.static String
getReportPluginProperty
(org.netbeans.api.project.Project prj, String groupId, String artifactId, String property, String report) tries to figure out if the property of the given report plugin is customized in the current project and returns it's value if so, otherwise nullstatic String[]
getReportPluginPropertyList
(org.apache.maven.project.MavenProject prj, String groupId, String artifactId, String multiproperty, String singleproperty, String goal) gets the list of values for the given property, if configured in the current project.static String[]
getReportPluginPropertyList
(org.netbeans.api.project.Project prj, String groupId, String artifactId, String multiproperty, String singleproperty, String goal) gets the list of values for the given property, if configured in the current project.static String
getReportPluginVersion
(org.apache.maven.project.MavenProject prj, String groupId, String artifactId) LikegetPluginVersion(org.apache.maven.project.MavenProject, java.lang.String, java.lang.String)
but for report plugins.
-
Method Details
-
getPluginProperty
@Deprecated @CheckForNull public static String getPluginProperty(@NonNull org.netbeans.api.project.Project prj, @NonNull String groupId, @NonNull String artifactId, @NonNull String parameter, @NullAllowed String goal) Deprecated.use the variant with expressionProperty valuetries to figure out if the property of the given plugin is customized in the current project and returns it's value if so, otherwise null -
getPluginProperty
@CheckForNull public static String getPluginProperty(@NonNull org.netbeans.api.project.Project prj, @NonNull String groupId, @NonNull String artifactId, @NonNull String parameter, @NullAllowed String goal, @NullAllowed String expressionProperty) tries to figure out if the property of the given plugin is customized in the current project and returns it's value if so, otherwise null- Parameters:
parameter
- the name of the plugin parameter to look forexpressionProperty
- expression property that once defined (and plugin configuration is omitted) is used. only value, no ${}
-
getPluginProperty
@Deprecated @CheckForNull public static String getPluginProperty(@NonNull org.apache.maven.project.MavenProject prj, @NonNull String groupId, @NonNull String artifactId, @NonNull String parameter, @NullAllowed String goal) Deprecated.use the variant with expressionProperty valuetries to figure out if the property of the given plugin is customized in the current project and returns it's value if so, otherwise null Please NOTE that if you have access toProject
instance and yourMavenProject
is the project's own loaded one, then the variant withProject
as parameter is preferable. Faster and less prone to deadlock. -
getPluginProperty
@CheckForNull public static String getPluginProperty(@NonNull org.apache.maven.project.MavenProject prj, @NonNull String groupId, @NonNull String artifactId, @NonNull String parameter, @NullAllowed String goal, @NullAllowed String expressionProperty) tries to figure out if the property of the given plugin is customized in the current project and returns it's value if so, otherwise null- Parameters:
parameter
- the name of the plugin parameter to look forexpressionProperty
- expression property that once defined (and plugin configuration is omitted) is used. only value, no ${}
-
getPluginPropertyBuildable
public static <T> T getPluginPropertyBuildable(@NonNull org.netbeans.api.project.Project prj, @NonNull String groupId, @NonNull String artifactId, @NullAllowed String goal, @NonNull PluginPropertyUtils.ConfigurationBuilder<T> builder) tries to figure out if the property of the given plugin is customized in the current project and returns it's value if so, otherwise null- Since:
- 2.70
-
getPluginPropertyBuildable
public static <T> T getPluginPropertyBuildable(@NonNull org.apache.maven.project.MavenProject prj, @NonNull String groupId, @NonNull String artifactId, @NullAllowed String goal, @NonNull PluginPropertyUtils.ConfigurationBuilder<T> builder) tries to figure out if the property of the given plugin is customized in the current project and returns it's value if so, otherwise null- Since:
- 2.102
-
getReportPluginProperty
@CheckForNull public static String getReportPluginProperty(@NonNull org.netbeans.api.project.Project prj, @NonNull String groupId, @NonNull String artifactId, @NonNull String property, @NullAllowed String report) tries to figure out if the property of the given report plugin is customized in the current project and returns it's value if so, otherwise null -
getReportPluginProperty
@CheckForNull public static String getReportPluginProperty(@NonNull org.apache.maven.project.MavenProject prj, @NonNull String groupId, @NonNull String artifactId, @NonNull String property, @NullAllowed String report) tries to figure out if the property of the given report plugin is customized in the current project and returns it's value if so, otherwise null Please NOTE that if you have access toProject
instance and yourMavenProject
is the project's own loaded one, then the variant withProject
as parameter is preferable. Faster and less prone to deadlock. -
getPluginVersion
-
getReportPluginVersion
@CheckForNull public static String getReportPluginVersion(@NonNull org.apache.maven.project.MavenProject prj, @NonNull String groupId, @NonNull String artifactId) LikegetPluginVersion(org.apache.maven.project.MavenProject, java.lang.String, java.lang.String)
but for report plugins.- Since:
- 2.32
-
getPluginPropertyList
@CheckForNull public static String[] getPluginPropertyList(@NonNull org.netbeans.api.project.Project prj, @NonNull String groupId, @NonNull String artifactId, @NonNull String multiproperty, @NonNull String singleproperty, @NullAllowed String goal) gets the list of values for the given property, if configured in the current project.- Parameters:
multiproperty
- list's root element (eg. "sourceRoots")singleproperty
- - list's single value element (eg. "sourceRoot")
-
getPluginPropertyList
@CheckForNull public static String[] getPluginPropertyList(@NonNull org.apache.maven.project.MavenProject prj, @NonNull String groupId, @NonNull String artifactId, @NonNull String multiproperty, @NonNull String singleproperty, @NullAllowed String goal) gets the list of values for the given property, if configured in the current project. Please NOTE that if you have access toProject
instance and yourMavenProject
is the project's own loaded one, then the variant withProject
as parameter is preferable. Faster and less prone to deadlock.- Parameters:
multiproperty
- list's root element (eg. "sourceRoots")singleproperty
- - list's single value element (eg. "sourceRoot")
-
getReportPluginPropertyList
@CheckForNull public static String[] getReportPluginPropertyList(@NonNull org.netbeans.api.project.Project prj, @NonNull String groupId, @NonNull String artifactId, @NonNull String multiproperty, @NonNull String singleproperty, @NullAllowed String goal) gets the list of values for the given property, if configured in the current project.- Parameters:
multiproperty
- list's root element (eg. "sourceRoots")singleproperty
- - list's single value element (eg. "sourceRoot")
-
getReportPluginPropertyList
@CheckForNull public static String[] getReportPluginPropertyList(@NonNull org.apache.maven.project.MavenProject prj, @NonNull String groupId, @NonNull String artifactId, @NonNull String multiproperty, @NonNull String singleproperty, @NullAllowed String goal) gets the list of values for the given property, if configured in the current project. Please NOTE that if you have access toProject
instance and yourMavenProject
is the project's own loaded one, then the variant withProject
as parameter is preferable. Faster and less prone to deadlock.- Parameters:
multiproperty
- list's root element (eg. "sourceRoots")singleproperty
- - list's single value element (eg. "sourceRoot")
-
getPluginPropertyParameter
@CheckForNull public static Properties getPluginPropertyParameter(@NonNull org.netbeans.api.project.Project prj, @NonNull String groupId, @NonNull String artifactId, @NonNull String propertyParameter, @NullAllowed String goal) Loads name/value pairs from plugin configuration. Two syntaxes are supported:<params><key>value</key><flag/></params>
produces{key=value, flag=}
(last value is""
notnull
due toProperties
limitation);<params><param><name>key</name><value>value</value></param></params>
produces{key=value}
.- Returns:
- properties
-
getPluginPropertyParameter
@CheckForNull public static Properties getPluginPropertyParameter(@NonNull org.apache.maven.project.MavenProject prj, @NonNull String groupId, @NonNull String artifactId, @NonNull String propertyParameter, @NullAllowed String goal) Loads name/value pairs from plugin configuration. Please NOTE that if you have access toProject
instance and yourMavenProject
is the project's own loaded one, then the variant withProject
as parameter is preferable. Faster and less prone to deadlock. Two syntaxes are supported:<params><key>value</key><flag/></params>
produces{key=value, flag=}
(last value is""
notnull
due toProperties
limitation);<params><param><name>key</name><value>value</value></param></params>
produces{key=value}
.- Returns:
- properties
-
createEvaluator
@NonNull public static org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator createEvaluator(@NonNull org.netbeans.api.project.Project project) Evaluator usable for interpolating variables in non resolved (interpolated) models. Should not be necessary when dealing with the project'sMavenProject
instance accessed viaNbMavenProject.getMavenProject()
- Since:
- 2.57
-
createEvaluator
@NonNull public static org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator createEvaluator(@NonNull org.apache.maven.project.MavenProject prj) Evaluator usable for interpolating variables in non resolved (interpolated) models. Should not be necessary when dealing with the project'sMavenProject
instance accessed viaNbMavenProject.getMavenProject()
Please NOTE that if you have access toProject
instance, then the variant withProject
as parameter is preferable. Faster and less prone to deadlock.- Since:
- 2.32
-
getPluginPathProperty
@CheckForNull public static List<org.apache.maven.artifact.Artifact> getPluginPathProperty(@NonNull org.netbeans.api.project.Project project, @NonNull PluginPropertyUtils.PluginConfigPathParams query, boolean transitiveDependencies, @NullAllowed List<org.apache.maven.artifact.resolver.ArtifactResolutionException> errorsOpt) Converts a list of dependency declarations in the plugin configuration into list of Artifacts. Can add (transitive) dependencies. Useful to convert list of some dependencies into artifacts and subsequently into classpaths or (artifact) file lists. ThePluginPropertyUtils.PluginConfigPathParams
contains a property selector and other data to process the dependency list. If `errorsOpt` is notnull
, it will receive errors from artifact resolution, if any. Otherwise, errors are just ignored. The method returnsnull
if the plugin/execution property is not defined at all.- Parameters:
project
- the maven projectquery
- specifies the query for artifacts.transitiveDependencies
- if true, returns also transitive dependencies.errorsOpt
- if notnull
, will receive list of errors encountered.- Returns:
- list of artifacts for the property, or
null
if the property does not exist - Since:
- 2.151
-