Class PluginPropertyUtils

java.lang.Object
org.netbeans.modules.maven.api.PluginPropertyUtils

public class PluginPropertyUtils extends Object
Examines a POM for configuration of 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 value
      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
    • 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 for
      expressionProperty - 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 value
      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 Please NOTE that if you have access to Project instance and your MavenProject is the project's own loaded one, then the variant with Project 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 for
      expressionProperty - 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 to Project instance and your MavenProject is the project's own loaded one, then the variant with Project as parameter is preferable. Faster and less prone to deadlock.
    • getPluginVersion

      @CheckForNull public static String getPluginVersion(@NonNull org.apache.maven.project.MavenProject prj, @NonNull String groupId, @NonNull String artifactId)
      tries to figure out if the a plugin is defined in the project and return the version declared.
      Returns:
      version string or null
    • getReportPluginVersion

      @CheckForNull public static String getReportPluginVersion(@NonNull org.apache.maven.project.MavenProject prj, @NonNull String groupId, @NonNull String artifactId)
      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 to Project instance and your MavenProject is the project's own loaded one, then the variant with Project 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 to Project instance and your MavenProject is the project's own loaded one, then the variant with Project 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 "" not null due to Properties 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 to Project instance and your MavenProject is the project's own loaded one, then the variant with Project 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 "" not null due to Properties 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's MavenProject 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's MavenProject instance accessed viaNbMavenProject.getMavenProject() Please NOTE that if you have access to Project instance, then the variant with Project 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. The PluginPropertyUtils.PluginConfigPathParams contains a property selector and other data to process the dependency list. If `errorsOpt` is not null, it will receive errors from artifact resolution, if any. Otherwise, errors are just ignored. The method returns null if the plugin/execution property is not defined at all.
      Parameters:
      project - the maven project
      query - specifies the query for artifacts.
      transitiveDependencies - if true, returns also transitive dependencies.
      errorsOpt - if not null, will receive list of errors encountered.
      Returns:
      list of artifacts for the property, or null if the property does not exist
      Since:
      2.151