Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:Update
maven-plugin-plugin-bootstrap.33970
maven-plugin-plugin-bootstrap-resouces.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File maven-plugin-plugin-bootstrap-resouces.patch of Package maven-plugin-plugin-bootstrap.33970
--- maven-plugin-plugin/src/main/filtered-resources/META-INF/maven/org.apache.maven.plugins/maven-plugin-plugin/plugin-help.xml 1970-01-01 01:00:00.000000000 +0100 +++ maven-plugin-plugin/src/main/filtered-resources/META-INF/maven/org.apache.maven.plugins/maven-plugin-plugin/plugin-help.xml 2024-05-15 12:12:45.836896057 +0200 @@ -0,0 +1,348 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- Generated by maven-plugin-tools 3.13 (for help mojo with limited elements)--> + +<plugin> + <name>${project.name}</name> + <description>${project.description}</description> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + <goalPrefix>plugin</goalPrefix> + <mojos> + <mojo> + <goal>addPluginArtifactMetadata</goal> + <description>Inject any plugin-specific artifact metadata to the project's artifact, for subsequent installation and deployment. It is used: +* to add the latest metadata (which is plugin-specific) for shipping alongside the plugin's artifact +* to define plugin mapping in the group +See also: org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata, org.apache.maven.artifact.repository.metadata.GroupRepositoryMetadata</description> + <requiresDirectInvocation>false</requiresDirectInvocation> + <requiresProject>true</requiresProject> + <requiresReports>false</requiresReports> + <aggregator>false</aggregator> + <requiresOnline>false</requiresOnline> + <inheritedByDefault>true</inheritedByDefault> + <phase>package</phase> + <implementation>org.apache.maven.plugin.plugin.metadata.AddPluginArtifactMetadataMojo</implementation> + <language>java</language> + <instantiationStrategy>per-lookup</instantiationStrategy> + <executionStrategy>once-per-session</executionStrategy> + <since>2.0</since> + <threadSafe>true</threadSafe> + <parameters> + <parameter> + <name>goalPrefix</name> + <type>java.lang.String</type> + <required>false</required> + <editable>true</editable> + <description>The prefix for the plugin goal.</description> + </parameter> + <parameter> + <name>skip</name> + <type>boolean</type> + <since>2.8</since> + <required>false</required> + <editable>true</editable> + <description>Set this to "true" to skip invoking any goals or reports of the plugin.</description> + </parameter> + </parameters> + <configuration> + <skip implementation="boolean" default-value="false">${maven.plugin.skip}</skip> + </configuration> + </mojo> + <mojo> + <goal>descriptor</goal> + <description> +Generate a plugin descriptor. + +Note: Since 3.0, for Java plugin annotations support, default phase <http://maven.apache.org/ref/current/maven-core/lifecycles.html> defined by this goal is after the "compilation" of any scripts. This doesn't override the default binding coded at generate-resources phase in Maven core. +</description> + <requiresDependencyResolution>compile+runtime</requiresDependencyResolution> + <requiresDirectInvocation>false</requiresDirectInvocation> + <requiresProject>true</requiresProject> + <requiresReports>false</requiresReports> + <aggregator>false</aggregator> + <requiresOnline>false</requiresOnline> + <inheritedByDefault>true</inheritedByDefault> + <phase>process-classes</phase> + <implementation>org.apache.maven.plugin.plugin.DescriptorGeneratorMojo</implementation> + <language>java</language> + <instantiationStrategy>per-lookup</instantiationStrategy> + <executionStrategy>once-per-session</executionStrategy> + <since>2.0</since> + <threadSafe>true</threadSafe> + <parameters> + <parameter> + <name>checkExpectedProvidedScope</name> + <type>boolean</type> + <since>3.6.3</since> + <required>false</required> + <editable>true</editable> + <description>Flag controlling is "expected dependencies in provided scope" check to be performed or not. Default value: true.</description> + </parameter> + <parameter> + <name>encoding</name> + <type>java.lang.String</type> + <since>2.5</since> + <required>false</required> + <editable>true</editable> + <description>The file encoding of the source files.</description> + </parameter> + <parameter> + <name>expectedProvidedScopeExclusions</name> + <type>java.util.List<java.lang.String></type> + <since>3.6.3</since> + <required>false</required> + <editable>true</editable> + <description>List of groupId:artifactId strings of artifact coordinates that are to be excluded from "expected provided scope" check. Default value: ["org.apache.maven:maven-archiver", "org.apache.maven:maven-jxr", "org.apache.maven:plexus-utils"].</description> + </parameter> + <parameter> + <name>expectedProvidedScopeGroupIds</name> + <type>java.util.List<java.lang.String></type> + <since>3.6.3</since> + <required>false</required> + <editable>true</editable> + <description>List of groupId strings of artifact coordinates that are expected to be in "provided" scope. Default value: ["org.apache.maven"].</description> + </parameter> + <parameter> + <name>externalJavadocBaseUrls</name> + <alias>links</alias> + <type>java.util.List<java.net.URI></type> + <since>3.7.0</since> + <required>false</required> + <editable>true</editable> + <description>Creates links to existing external javadoc-generated documentation. +Notes: all given links should have a fetchable /package-list or /element-list file. For instance: <externalJavadocBaseUrls> <externalJavadocBaseUrl>https://docs.oracle.com/javase/8/docs/api/</externalJavadocBaseUrl> </externalJavadocBaseUrls> is valid because https://docs.oracle.com/javase/8/docs/api/package-list exists. See link option of the javadoc tool <https://docs.oracle.com/en/java/javase/17/docs/specs/man/javadoc.html#standard-doclet-options>. Using this parameter requires connectivity to the given URLs during the goal execution.</description> + </parameter> + <parameter> + <name>extractors</name> + <type>java.util.Set<java.lang.String></type> + <required>false</required> + <editable>true</editable> + <description> +The role names of mojo extractors to use. + +If not set, all mojo extractors will be used. If set to an empty extractor name, no mojo extractors will be used. +Example: <!-- Use all mojo extractors --> <extractors/> <!-- Use no mojo extractors --> <extractors> <extractor/> </extractors> <!-- Use only bsh mojo extractor --> <extractors> <extractor>bsh</extractor> </extractors> The extractors with the following names ship with maven-plugin-tools: +* java-annotations +* java-javadoc, deprecated +* ant, deprecated +* bsh, deprecated </description> + </parameter> + <parameter> + <name>goalPrefix</name> + <type>java.lang.String</type> + <required>false</required> + <editable>true</editable> + <description>The goal prefix that will appear before the ":".</description> + </parameter> + <parameter> + <name>internalJavadocBaseUrl</name> + <type>java.net.URI</type> + <since>3.7.0</since> + <required>false</required> + <editable>true</editable> + <description>The base URL for the Javadoc site containing the current project's API documentation. This may be relative to the root of the generated Maven site. It does not need to exist yet at the time when this goal is executed. Must end with a slash. In case this is set the javadoc reporting goal should be executed prior to Plugin Report.</description> + </parameter> + <parameter> + <name>internalJavadocVersion</name> + <type>java.lang.String</type> + <since>3.7.0</since> + <required>false</required> + <editable>true</editable> + <description>The version of the javadoc tool (equal to the container JDK version) used to generate the internal javadoc Only relevant if internalJavadocBaseUrl is set. The default value needs to be overwritten in case toolchains are being used for generating Javadoc.</description> + </parameter> + <parameter> + <name>mojoDependencies</name> + <type>java.util.List<java.lang.String></type> + <since>3.5</since> + <required>false</required> + <editable>true</editable> + <description>Specify the dependencies as groupId:artifactId containing (abstract) Mojos, to filter dependencies scanned at runtime and focus on dependencies that are really useful to Mojo analysis. By default, the value is null and all dependencies are scanned (as before this parameter was added). If specified in the configuration with no children, no dependencies are scanned.</description> + </parameter> + <parameter> + <name>packagingTypes</name> + <type>java.util.List<java.lang.String></type> + <since>3.3</since> + <required>false</required> + <editable>true</editable> + <description>Maven plugin packaging types. Default is single "maven-plugin".</description> + </parameter> + <parameter> + <name>requiredJavaVersion</name> + <type>java.lang.String</type> + <since>3.8.0</since> + <required>false</required> + <editable>true</editable> + <description>The required Java version to set in the plugin descriptor. This is evaluated by Maven 4 and ignored by earlier Maven versions. Can be either one of the following formats: +* A version range which specifies the supported Java versions. It can either use the usual mathematical syntax like "[1.7,9),[11,)" or use a single version like "1.8". The latter is a short form for "[1.8,)", i.e. denotes the minimum version required. +* "auto" to determine the minimum Java version from the binary class version being generated during compilation (determined by the extractor). </description> + </parameter> + <parameter> + <name>requiredMavenVersion</name> + <type>java.lang.String</type> + <since>3.8.0</since> + <required>false</required> + <editable>true</editable> + <description>The required Maven version to set in the plugin descriptor. This is evaluated by Maven 4 and ignored by earlier Maven versions. Can be either one of the following formats: +* A version range which specifies the supported Maven versions. It can either use the usual mathematical syntax like "[2.0.10,2.1.0),[3.0,)" or use a single version like "2.2.1". The latter is a short form for "[2.2.1,)", i.e. denotes the minimum version required. +* "auto" to determine the minimum Maven version from the POM's Maven prerequisite, or if not set the referenced Maven Plugin API version. This value takes precedence over the POM's Maven prerequisite <https://maven.apache.org/pom.html#Prerequisites> in Maven 4.</description> + </parameter> + <parameter> + <name>skip</name> + <type>boolean</type> + <since>2.8</since> + <required>false</required> + <editable>true</editable> + <description>Set this to "true" to skip invoking any goals or reports of the plugin.</description> + </parameter> + <parameter> + <name>skipDescriptor</name> + <type>boolean</type> + <since>2.6</since> + <required>false</required> + <editable>true</editable> + <description>A flag to disable generation of the plugin.xml in favor of a hand authored plugin descriptor.</description> + </parameter> + <parameter> + <name>skipErrorNoDescriptorsFound</name> + <type>boolean</type> + <since>3.0</since> + <required>false</required> + <editable>true</editable> + <description>By default, an exception is throw if no mojo descriptor is found. As the maven-plugin is defined in core, the descriptor generator mojo is bound to generate-resources phase. But for annotations, the compiled classes are needed, so skip error</description> + </parameter> + </parameters> + <configuration> + <checkExpectedProvidedScope implementation="boolean" default-value="true">${maven.plugin.checkExpectedProvidedScope}</checkExpectedProvidedScope> + <encoding implementation="java.lang.String" default-value="${project.build.sourceEncoding}">${encoding}</encoding> + <externalJavadocBaseUrls implementation="java.util.List">${externalJavadocBaseUrls}</externalJavadocBaseUrls> + <internalJavadocBaseUrl implementation="java.net.URI">${internalJavadocBaseUrl}</internalJavadocBaseUrl> + <internalJavadocVersion implementation="java.lang.String" default-value="${java.version}">${internalJavadocVersion}</internalJavadocVersion> + <requiredJavaVersion implementation="java.lang.String" default-value="auto"/> + <requiredMavenVersion implementation="java.lang.String" default-value="auto"/> + <skip implementation="boolean" default-value="false">${maven.plugin.skip}</skip> + <skipDescriptor implementation="boolean" default-value="false"/> + <skipErrorNoDescriptorsFound implementation="boolean" default-value="false">${maven.plugin.skipErrorNoDescriptorsFound}</skipErrorNoDescriptorsFound> + </configuration> + </mojo> + <mojo> + <goal>help</goal> + <description>Display help information on maven-plugin-plugin. +Call mvn plugin:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.</description> + <requiresDirectInvocation>false</requiresDirectInvocation> + <requiresProject>false</requiresProject> + <requiresReports>false</requiresReports> + <aggregator>false</aggregator> + <requiresOnline>false</requiresOnline> + <inheritedByDefault>true</inheritedByDefault> + <implementation>org.apache.maven.plugins.maven_plugin_plugin.HelpMojo</implementation> + <language>java</language> + <instantiationStrategy>per-lookup</instantiationStrategy> + <executionStrategy>once-per-session</executionStrategy> + <threadSafe>true</threadSafe> + <parameters> + <parameter> + <name>detail</name> + <type>boolean</type> + <required>false</required> + <editable>true</editable> + <description>If true, display all settable properties for each goal.</description> + </parameter> + <parameter> + <name>goal</name> + <type>java.lang.String</type> + <required>false</required> + <editable>true</editable> + <description>The name of the goal for which to show help. If unspecified, all goals will be displayed.</description> + </parameter> + <parameter> + <name>indentSize</name> + <type>int</type> + <required>false</required> + <editable>true</editable> + <description>The number of spaces per indentation level, should be positive.</description> + </parameter> + <parameter> + <name>lineLength</name> + <type>int</type> + <required>false</required> + <editable>true</editable> + <description>The maximum length of a display line, should be positive.</description> + </parameter> + </parameters> + <configuration> + <detail implementation="boolean" default-value="false">${detail}</detail> + <goal implementation="java.lang.String">${goal}</goal> + <indentSize implementation="int" default-value="2">${indentSize}</indentSize> + <lineLength implementation="int" default-value="80">${lineLength}</lineLength> + </configuration> + </mojo> + <mojo> + <goal>helpmojo</goal> + <description>Generates a HelpMojo class. Relies at runtime on one output file from DescriptorGeneratorMojo.</description> + <requiresDependencyResolution>compile</requiresDependencyResolution> + <requiresDirectInvocation>false</requiresDirectInvocation> + <requiresProject>true</requiresProject> + <requiresReports>false</requiresReports> + <aggregator>false</aggregator> + <requiresOnline>false</requiresOnline> + <inheritedByDefault>true</inheritedByDefault> + <phase>generate-sources</phase> + <implementation>org.apache.maven.plugin.plugin.HelpGeneratorMojo</implementation> + <language>java</language> + <instantiationStrategy>per-lookup</instantiationStrategy> + <executionStrategy>once-per-session</executionStrategy> + <since>2.4</since> + <threadSafe>true</threadSafe> + <parameters> + <parameter> + <name>goalPrefix</name> + <type>java.lang.String</type> + <required>false</required> + <editable>true</editable> + <description>The goal prefix that will appear before the ":".</description> + </parameter> + <parameter> + <name>helpPackageName</name> + <type>java.lang.String</type> + <since>2.6</since> + <required>false</required> + <editable>true</editable> + <description>The name of the package for the generated HelpMojo. +By default, the package name will be calculated as groupId + "." + artifactId with additional + +* - (dashes) will be replaced by _ (underscores) +* _ (underscore) will be added before each number or Java keyword at the beginning of name </description> + </parameter> + <parameter> + <name>outputDirectory</name> + <type>java.io.File</type> + <required>false</required> + <editable>true</editable> + <description>The directory where the generated HelpMojo file will be put.</description> + </parameter> + <parameter> + <name>packagingTypes</name> + <type>java.util.List<java.lang.String></type> + <since>3.3</since> + <required>false</required> + <editable>true</editable> + <description>Maven plugin packaging types. Default is single "maven-plugin".</description> + </parameter> + <parameter> + <name>skip</name> + <type>boolean</type> + <since>2.8</since> + <required>false</required> + <editable>true</editable> + <description>Set this to "true" to skip invoking any goals or reports of the plugin.</description> + </parameter> + </parameters> + <configuration> + <outputDirectory implementation="java.io.File" default-value="${project.build.directory}/generated-sources/plugin"/> + <skip implementation="boolean" default-value="false">${maven.plugin.skip}</skip> + </configuration> + </mojo> + </mojos> +</plugin> --- maven-plugin-plugin/src/main/filtered-resources/META-INF/maven/plugin.xml 1970-01-01 01:00:00.000000000 +0100 +++ maven-plugin-plugin/src/main/filtered-resources/META-INF/maven/plugin.xml 2024-05-15 12:12:16.933350354 +0200 @@ -0,0 +1,610 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- Generated by maven-plugin-tools 3.13--> + +<plugin> + <name>${project.name}</name> + <description>${project.description}</description> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + <goalPrefix>plugin</goalPrefix> + <isolatedRealm>false</isolatedRealm> + <inheritedByDefault>true</inheritedByDefault> + <requiredJavaVersion>1.8</requiredJavaVersion> + <requiredMavenVersion>3.6.3</requiredMavenVersion> + <mojos> + <mojo> + <goal>addPluginArtifactMetadata</goal> + <description>Inject any plugin-specific artifact metadata to the project's artifact, for subsequent installation and deployment. It is used: +* to add the latest metadata (which is plugin-specific) for shipping alongside the plugin's artifact +* to define plugin mapping in the group +See also: org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata, org.apache.maven.artifact.repository.metadata.GroupRepositoryMetadata</description> + <requiresDirectInvocation>false</requiresDirectInvocation> + <requiresProject>true</requiresProject> + <requiresReports>false</requiresReports> + <aggregator>false</aggregator> + <requiresOnline>false</requiresOnline> + <inheritedByDefault>true</inheritedByDefault> + <phase>package</phase> + <implementation>org.apache.maven.plugin.plugin.metadata.AddPluginArtifactMetadataMojo</implementation> + <language>java</language> + <instantiationStrategy>per-lookup</instantiationStrategy> + <executionStrategy>once-per-session</executionStrategy> + <since>2.0</since> + <threadSafe>true</threadSafe> + <parameters> + <parameter> + <name>goalPrefix</name> + <type>java.lang.String</type> + <required>false</required> + <editable>true</editable> + <description>The prefix for the plugin goal.</description> + </parameter> + <parameter> + <name>skip</name> + <type>boolean</type> + <since>2.8</since> + <required>false</required> + <editable>true</editable> + <description>Set this to "true" to skip invoking any goals or reports of the plugin.</description> + </parameter> + </parameters> + <configuration> + <skip implementation="boolean" default-value="false">${maven.plugin.skip}</skip> + </configuration> + <requirements> + <requirement> + <role>org.apache.maven.project.MavenProject</role> + <field-name>project</field-name> + </requirement> + <requirement> + <role>org.apache.maven.rtinfo.RuntimeInformation</role> + <field-name>runtimeInformation</field-name> + </requirement> + </requirements> + </mojo> + <mojo> + <goal>descriptor</goal> + <description> +Generate a plugin descriptor. + +Note: Since 3.0, for Java plugin annotations support, default phase <http://maven.apache.org/ref/current/maven-core/lifecycles.html> defined by this goal is after the "compilation" of any scripts. This doesn't override the default binding coded at generate-resources phase in Maven core. +</description> + <requiresDependencyResolution>compile+runtime</requiresDependencyResolution> + <requiresDirectInvocation>false</requiresDirectInvocation> + <requiresProject>true</requiresProject> + <requiresReports>false</requiresReports> + <aggregator>false</aggregator> + <requiresOnline>false</requiresOnline> + <inheritedByDefault>true</inheritedByDefault> + <phase>process-classes</phase> + <implementation>org.apache.maven.plugin.plugin.DescriptorGeneratorMojo</implementation> + <language>java</language> + <instantiationStrategy>per-lookup</instantiationStrategy> + <executionStrategy>once-per-session</executionStrategy> + <since>2.0</since> + <threadSafe>true</threadSafe> + <parameters> + <parameter> + <name>checkExpectedProvidedScope</name> + <type>boolean</type> + <since>3.6.3</since> + <required>false</required> + <editable>true</editable> + <description>Flag controlling is "expected dependencies in provided scope" check to be performed or not. Default value: true.</description> + </parameter> + <parameter> + <name>encoding</name> + <type>java.lang.String</type> + <since>2.5</since> + <required>false</required> + <editable>true</editable> + <description>The file encoding of the source files.</description> + </parameter> + <parameter> + <name>expectedProvidedScopeExclusions</name> + <type>java.util.List</type> + <since>3.6.3</since> + <required>false</required> + <editable>true</editable> + <description>List of groupId:artifactId strings of artifact coordinates that are to be excluded from "expected provided scope" check. Default value: ["org.apache.maven:maven-archiver", "org.apache.maven:maven-jxr", "org.apache.maven:plexus-utils"].</description> + </parameter> + <parameter> + <name>expectedProvidedScopeGroupIds</name> + <type>java.util.List</type> + <since>3.6.3</since> + <required>false</required> + <editable>true</editable> + <description>List of groupId strings of artifact coordinates that are expected to be in "provided" scope. Default value: ["org.apache.maven"].</description> + </parameter> + <parameter> + <name>externalJavadocBaseUrls</name> + <alias>links</alias> + <type>java.util.List</type> + <since>3.7.0</since> + <required>false</required> + <editable>true</editable> + <description>Creates links to existing external javadoc-generated documentation. +Notes: all given links should have a fetchable /package-list or /element-list file. For instance: <externalJavadocBaseUrls> <externalJavadocBaseUrl>https://docs.oracle.com/javase/8/docs/api/</externalJavadocBaseUrl> </externalJavadocBaseUrls> is valid because https://docs.oracle.com/javase/8/docs/api/package-list exists. See link option of the javadoc tool <https://docs.oracle.com/en/java/javase/17/docs/specs/man/javadoc.html#standard-doclet-options>. Using this parameter requires connectivity to the given URLs during the goal execution.</description> + </parameter> + <parameter> + <name>extractors</name> + <type>java.util.Set</type> + <required>false</required> + <editable>true</editable> + <description> +The role names of mojo extractors to use. + +If not set, all mojo extractors will be used. If set to an empty extractor name, no mojo extractors will be used. +Example: <!-- Use all mojo extractors --> <extractors/> <!-- Use no mojo extractors --> <extractors> <extractor/> </extractors> <!-- Use only bsh mojo extractor --> <extractors> <extractor>bsh</extractor> </extractors> The extractors with the following names ship with maven-plugin-tools: +* java-annotations +* java-javadoc, deprecated +* ant, deprecated +* bsh, deprecated </description> + </parameter> + <parameter> + <name>goalPrefix</name> + <type>java.lang.String</type> + <required>false</required> + <editable>true</editable> + <description>The goal prefix that will appear before the ":".</description> + </parameter> + <parameter> + <name>internalJavadocBaseUrl</name> + <type>java.net.URI</type> + <since>3.7.0</since> + <required>false</required> + <editable>true</editable> + <description>The base URL for the Javadoc site containing the current project's API documentation. This may be relative to the root of the generated Maven site. It does not need to exist yet at the time when this goal is executed. Must end with a slash. In case this is set the javadoc reporting goal should be executed prior to Plugin Report.</description> + </parameter> + <parameter> + <name>internalJavadocVersion</name> + <type>java.lang.String</type> + <since>3.7.0</since> + <required>false</required> + <editable>true</editable> + <description>The version of the javadoc tool (equal to the container JDK version) used to generate the internal javadoc Only relevant if internalJavadocBaseUrl is set. The default value needs to be overwritten in case toolchains are being used for generating Javadoc.</description> + </parameter> + <parameter> + <name>mojoDependencies</name> + <type>java.util.List</type> + <since>3.5</since> + <required>false</required> + <editable>true</editable> + <description>Specify the dependencies as groupId:artifactId containing (abstract) Mojos, to filter dependencies scanned at runtime and focus on dependencies that are really useful to Mojo analysis. By default, the value is null and all dependencies are scanned (as before this parameter was added). If specified in the configuration with no children, no dependencies are scanned.</description> + </parameter> + <parameter> + <name>outputDirectory</name> + <type>java.io.File</type> + <required>false</required> + <editable>false</editable> + <description>The directory where the generated plugin.xml file will be put.</description> + </parameter> + <parameter> + <name>packagingTypes</name> + <type>java.util.List</type> + <since>3.3</since> + <required>false</required> + <editable>true</editable> + <description>Maven plugin packaging types. Default is single "maven-plugin".</description> + </parameter> + <parameter> + <name>requiredJavaVersion</name> + <type>java.lang.String</type> + <since>3.8.0</since> + <required>false</required> + <editable>true</editable> + <description>The required Java version to set in the plugin descriptor. This is evaluated by Maven 4 and ignored by earlier Maven versions. Can be either one of the following formats: +* A version range which specifies the supported Java versions. It can either use the usual mathematical syntax like "[1.7,9),[11,)" or use a single version like "1.8". The latter is a short form for "[1.8,)", i.e. denotes the minimum version required. +* "auto" to determine the minimum Java version from the binary class version being generated during compilation (determined by the extractor). </description> + </parameter> + <parameter> + <name>requiredMavenVersion</name> + <type>java.lang.String</type> + <since>3.8.0</since> + <required>false</required> + <editable>true</editable> + <description>The required Maven version to set in the plugin descriptor. This is evaluated by Maven 4 and ignored by earlier Maven versions. Can be either one of the following formats: +* A version range which specifies the supported Maven versions. It can either use the usual mathematical syntax like "[2.0.10,2.1.0),[3.0,)" or use a single version like "2.2.1". The latter is a short form for "[2.2.1,)", i.e. denotes the minimum version required. +* "auto" to determine the minimum Maven version from the POM's Maven prerequisite, or if not set the referenced Maven Plugin API version. This value takes precedence over the POM's Maven prerequisite <https://maven.apache.org/pom.html#Prerequisites> in Maven 4.</description> + </parameter> + <parameter> + <name>skip</name> + <type>boolean</type> + <since>2.8</since> + <required>false</required> + <editable>true</editable> + <description>Set this to "true" to skip invoking any goals or reports of the plugin.</description> + </parameter> + <parameter> + <name>skipDescriptor</name> + <type>boolean</type> + <since>2.6</since> + <required>false</required> + <editable>true</editable> + <description>A flag to disable generation of the plugin.xml in favor of a hand authored plugin descriptor.</description> + </parameter> + <parameter> + <name>skipErrorNoDescriptorsFound</name> + <type>boolean</type> + <since>3.0</since> + <required>false</required> + <editable>true</editable> + <description>By default, an exception is throw if no mojo descriptor is found. As the maven-plugin is defined in core, the descriptor generator mojo is bound to generate-resources phase. But for annotations, the compiled classes are needed, so skip error</description> + </parameter> + </parameters> + <configuration> + <checkExpectedProvidedScope implementation="boolean" default-value="true">${maven.plugin.checkExpectedProvidedScope}</checkExpectedProvidedScope> + <encoding implementation="java.lang.String" default-value="${project.build.sourceEncoding}">${encoding}</encoding> + <externalJavadocBaseUrls implementation="java.util.List">${externalJavadocBaseUrls}</externalJavadocBaseUrls> + <internalJavadocBaseUrl implementation="java.net.URI">${internalJavadocBaseUrl}</internalJavadocBaseUrl> + <internalJavadocVersion implementation="java.lang.String" default-value="${java.version}">${internalJavadocVersion}</internalJavadocVersion> + <outputDirectory implementation="java.io.File" default-value="${project.build.outputDirectory}/META-INF/maven"/> + <requiredJavaVersion implementation="java.lang.String" default-value="auto"/> + <requiredMavenVersion implementation="java.lang.String" default-value="auto"/> + <skip implementation="boolean" default-value="false">${maven.plugin.skip}</skip> + <skipDescriptor implementation="boolean" default-value="false"/> + <skipErrorNoDescriptorsFound implementation="boolean" default-value="false">${maven.plugin.skipErrorNoDescriptorsFound}</skipErrorNoDescriptorsFound> + </configuration> + <requirements> + <requirement> + <role>org.sonatype.plexus.build.incremental.BuildContext</role> + <field-name>buildContext</field-name> + </requirement> + <requirement> + <role>org.apache.maven.execution.MavenSession</role> + <field-name>mavenSession</field-name> + </requirement> + <requirement> + <role>org.apache.maven.tools.plugin.scanner.MojoScanner</role> + <field-name>mojoScanner</field-name> + </requirement> + <requirement> + <role>org.apache.maven.project.MavenProject</role> + <field-name>project</field-name> + </requirement> + </requirements> + </mojo> + <mojo> + <goal>help</goal> + <description>Display help information on maven-plugin-plugin. +Call mvn plugin:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.</description> + <requiresDirectInvocation>false</requiresDirectInvocation> + <requiresProject>false</requiresProject> + <requiresReports>false</requiresReports> + <aggregator>false</aggregator> + <requiresOnline>false</requiresOnline> + <inheritedByDefault>true</inheritedByDefault> + <implementation>org.apache.maven.plugins.maven_plugin_plugin.HelpMojo</implementation> + <language>java</language> + <instantiationStrategy>per-lookup</instantiationStrategy> + <executionStrategy>once-per-session</executionStrategy> + <threadSafe>true</threadSafe> + <parameters> + <parameter> + <name>detail</name> + <type>boolean</type> + <required>false</required> + <editable>true</editable> + <description>If true, display all settable properties for each goal.</description> + </parameter> + <parameter> + <name>goal</name> + <type>java.lang.String</type> + <required>false</required> + <editable>true</editable> + <description>The name of the goal for which to show help. If unspecified, all goals will be displayed.</description> + </parameter> + <parameter> + <name>indentSize</name> + <type>int</type> + <required>false</required> + <editable>true</editable> + <description>The number of spaces per indentation level, should be positive.</description> + </parameter> + <parameter> + <name>lineLength</name> + <type>int</type> + <required>false</required> + <editable>true</editable> + <description>The maximum length of a display line, should be positive.</description> + </parameter> + </parameters> + <configuration> + <detail implementation="boolean" default-value="false">${detail}</detail> + <goal implementation="java.lang.String">${goal}</goal> + <indentSize implementation="int" default-value="2">${indentSize}</indentSize> + <lineLength implementation="int" default-value="80">${lineLength}</lineLength> + </configuration> + </mojo> + <mojo> + <goal>helpmojo</goal> + <description>Generates a HelpMojo class. Relies at runtime on one output file from DescriptorGeneratorMojo.</description> + <requiresDependencyResolution>compile</requiresDependencyResolution> + <requiresDirectInvocation>false</requiresDirectInvocation> + <requiresProject>true</requiresProject> + <requiresReports>false</requiresReports> + <aggregator>false</aggregator> + <requiresOnline>false</requiresOnline> + <inheritedByDefault>true</inheritedByDefault> + <phase>generate-sources</phase> + <implementation>org.apache.maven.plugin.plugin.HelpGeneratorMojo</implementation> + <language>java</language> + <instantiationStrategy>per-lookup</instantiationStrategy> + <executionStrategy>once-per-session</executionStrategy> + <since>2.4</since> + <threadSafe>true</threadSafe> + <parameters> + <parameter> + <name>goalPrefix</name> + <type>java.lang.String</type> + <required>false</required> + <editable>true</editable> + <description>The goal prefix that will appear before the ":".</description> + </parameter> + <parameter> + <name>helpPackageName</name> + <type>java.lang.String</type> + <since>2.6</since> + <required>false</required> + <editable>true</editable> + <description>The name of the package for the generated HelpMojo. +By default, the package name will be calculated as groupId + "." + artifactId with additional + +* - (dashes) will be replaced by _ (underscores) +* _ (underscore) will be added before each number or Java keyword at the beginning of name </description> + </parameter> + <parameter> + <name>outputDirectory</name> + <type>java.io.File</type> + <required>false</required> + <editable>true</editable> + <description>The directory where the generated HelpMojo file will be put.</description> + </parameter> + <parameter> + <name>packagingTypes</name> + <type>java.util.List</type> + <since>3.3</since> + <required>false</required> + <editable>true</editable> + <description>Maven plugin packaging types. Default is single "maven-plugin".</description> + </parameter> + <parameter> + <name>skip</name> + <type>boolean</type> + <since>2.8</since> + <required>false</required> + <editable>true</editable> + <description>Set this to "true" to skip invoking any goals or reports of the plugin.</description> + </parameter> + </parameters> + <configuration> + <outputDirectory implementation="java.io.File" default-value="${project.build.directory}/generated-sources/plugin"/> + <skip implementation="boolean" default-value="false">${maven.plugin.skip}</skip> + </configuration> + <requirements> + <requirement> + <role>org.apache.maven.project.MavenProject</role> + <field-name>project</field-name> + </requirement> + <requirement> + <role>org.codehaus.plexus.velocity.VelocityComponent</role> + <field-name>velocity</field-name> + </requirement> + </requirements> + </mojo> + </mojos> + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <type>jar</type> + <version>1.7.36</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <type>jar</type> + <version>3.12.0</version> + </dependency> + <dependency> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + <type>jar</type> + <version>1</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-xml</artifactId> + <type>jar</type> + <version>3.0.0</version> + </dependency> + <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-api</artifactId> + <type>jar</type> + <version>3.13.0</version> + </dependency> + <dependency> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-provider-api</artifactId> + <type>jar</type> + <version>2.4</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-java</artifactId> + <type>jar</type> + <version>1.2.0</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <type>jar</type> + <version>4.5.14</version> + </dependency> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <type>jar</type> + <version>1.2</version> + </dependency> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <type>jar</type> + <version>1.11</version> + </dependency> + <dependency> + <groupId>org.apache.maven.reporting</groupId> + <artifactId>maven-reporting-api</artifactId> + <type>jar</type> + <version>3.1.1</version> + </dependency> + <dependency> + <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-sink-api</artifactId> + <type>jar</type> + <version>1.11.1</version> + </dependency> + <dependency> + <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-logging-api</artifactId> + <type>jar</type> + <version>1.12.0</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpcore</artifactId> + <type>jar</type> + <version>4.4.16</version> + </dependency> + <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-generators</artifactId> + <type>jar</type> + <version>3.13.0</version> + </dependency> + <dependency> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> + <type>jar</type> + <version>9.7</version> + </dependency> + <dependency> + <groupId>org.ow2.asm</groupId> + <artifactId>asm-commons</artifactId> + <type>jar</type> + <version>9.7</version> + </dependency> + <dependency> + <groupId>org.ow2.asm</groupId> + <artifactId>asm-tree</artifactId> + <type>jar</type> + <version>9.7</version> + </dependency> + <dependency> + <groupId>org.jsoup</groupId> + <artifactId>jsoup</artifactId> + <type>jar</type> + <version>1.17.2</version> + </dependency> + <dependency> + <groupId>org.apache.velocity</groupId> + <artifactId>velocity</artifactId> + <type>jar</type> + <version>1.7</version> + </dependency> + <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-java</artifactId> + <type>jar</type> + <version>3.13.0</version> + </dependency> + <dependency> + <groupId>com.thoughtworks.qdox</groupId> + <artifactId>qdox</artifactId> + <type>jar</type> + <version>2.1.0</version> + </dependency> + <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-annotations</artifactId> + <type>jar</type> + <version>3.13.0</version> + </dependency> + <dependency> + <groupId>org.ow2.asm</groupId> + <artifactId>asm-util</artifactId> + <type>jar</type> + <version>9.7</version> + </dependency> + <dependency> + <groupId>org.ow2.asm</groupId> + <artifactId>asm-analysis</artifactId> + <type>jar</type> + <version>9.7</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-archiver</artifactId> + <type>jar</type> + <version>4.9.2</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-io</artifactId> + <type>jar</type> + <version>3.4.1</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <type>jar</type> + <version>2.13.0</version> + </dependency> + <dependency> + <groupId>org.tukaani</groupId> + <artifactId>xz</artifactId> + <type>jar</type> + <version>1.9</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-compress</artifactId> + <type>jar</type> + <version>1.23.0</version> + </dependency> + <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-annotations</artifactId> + <type>jar</type> + <version>3.13.0</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-utils</artifactId> + <type>jar</type> + <version>4.0.1</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-velocity</artifactId> + <type>jar</type> + <version>1.2</version> + </dependency> + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <type>jar</type> + <version>3.1</version> + </dependency> + <dependency> + <groupId>org.sonatype.plexus</groupId> + <artifactId>plexus-build-api</artifactId> + <type>jar</type> + <version>0.0.7</version> + </dependency> + </dependencies> +</plugin> --- maven-plugin-plugin/src/main/java/org/apache/maven/plugins/maven_plugin_plugin/HelpMojo.java 1970-01-01 01:00:00.000000000 +0100 +++ maven-plugin-plugin/src/main/java/org/apache/maven/plugins/maven_plugin_plugin/HelpMojo.java 2024-05-15 12:11:33.063028019 +0200 @@ -0,0 +1,448 @@ +package org.apache.maven.plugins.maven_plugin_plugin; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +/** + * Display help information on maven-plugin-plugin.<br> + * Call <code>mvn plugin:help -Ddetail=true -Dgoal=<goal-name></code> to display parameter details. + * @author maven-plugin-tools + */ +@Mojo( name = "help", requiresProject = false, threadSafe = true ) +public class HelpMojo + extends AbstractMojo +{ + /** + * If <code>true</code>, display all settable properties for each goal. + * + */ + @Parameter( property = "detail", defaultValue = "false" ) + private boolean detail; + + /** + * The name of the goal for which to show help. If unspecified, all goals will be displayed. + * + */ + @Parameter( property = "goal" ) + private java.lang.String goal; + + /** + * The maximum length of a display line, should be positive. + * + */ + @Parameter( property = "lineLength", defaultValue = "80" ) + private int lineLength; + + /** + * The number of spaces per indentation level, should be positive. + * + */ + @Parameter( property = "indentSize", defaultValue = "2" ) + private int indentSize; + + // /META-INF/maven/<groupId>/<artifactId>/plugin-help.xml + private static final String PLUGIN_HELP_PATH = + "/META-INF/maven/org.apache.maven.plugins/maven-plugin-plugin/plugin-help.xml"; + + private static final int DEFAULT_LINE_LENGTH = 80; + + private Document build() + throws MojoExecutionException + { + getLog().debug( "load plugin-help.xml: " + PLUGIN_HELP_PATH ); + try ( InputStream is = getClass().getResourceAsStream( PLUGIN_HELP_PATH ) ) + { + if ( is == null ) + { + throw new MojoExecutionException( "Could not find plugin descriptor at " + PLUGIN_HELP_PATH ); + } + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); + return dBuilder.parse( is ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + catch ( ParserConfigurationException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + catch ( SAXException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void execute() + throws MojoExecutionException + { + if ( lineLength <= 0 ) + { + getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." ); + lineLength = DEFAULT_LINE_LENGTH; + } + if ( indentSize <= 0 ) + { + getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." ); + indentSize = 2; + } + + Document doc = build(); + + StringBuilder sb = new StringBuilder(); + Node plugin = getSingleChild( doc, "plugin" ); + + + String name = getValue( plugin, "name" ); + String version = getValue( plugin, "version" ); + String id = getValue( plugin, "groupId" ) + ":" + getValue( plugin, "artifactId" ) + ":" + version; + if ( isNotEmpty( name ) && !name.contains( id ) ) + { + append( sb, name + " " + version, 0 ); + } + else + { + if ( isNotEmpty( name ) ) + { + append( sb, name, 0 ); + } + else + { + append( sb, id, 0 ); + } + } + append( sb, getValue( plugin, "description" ), 1 ); + append( sb, "", 0 ); + + //<goalPrefix>plugin</goalPrefix> + String goalPrefix = getValue( plugin, "goalPrefix" ); + + Node mojos1 = getSingleChild( plugin, "mojos" ); + + List<Node> mojos = findNamedChild( mojos1, "mojo" ); + + if ( goal == null || goal.length() <= 0 ) + { + append( sb, "This plugin has " + mojos.size() + ( mojos.size() > 1 ? " goals:" : " goal:" ), 0 ); + append( sb, "", 0 ); + } + + for ( Node mojo : mojos ) + { + writeGoal( sb, goalPrefix, (Element) mojo ); + } + + if ( getLog().isInfoEnabled() ) + { + getLog().info( sb.toString() ); + } + } + + + private static boolean isNotEmpty( String string ) + { + return string != null && string.length() > 0; + } + + private static String getValue( Node node, String elementName ) + throws MojoExecutionException + { + return getSingleChild( node, elementName ).getTextContent(); + } + + private static Node getSingleChild( Node node, String elementName ) + throws MojoExecutionException + { + List<Node> namedChild = findNamedChild( node, elementName ); + if ( namedChild.isEmpty() ) + { + throw new MojoExecutionException( "Could not find " + elementName + " in plugin-help.xml" ); + } + if ( namedChild.size() > 1 ) + { + throw new MojoExecutionException( "Multiple " + elementName + " in plugin-help.xml" ); + } + return namedChild.get( 0 ); + } + + private static List<Node> findNamedChild( Node node, String elementName ) + { + List<Node> result = new ArrayList<Node>(); + NodeList childNodes = node.getChildNodes(); + for ( int i = 0; i < childNodes.getLength(); i++ ) + { + Node item = childNodes.item( i ); + if ( elementName.equals( item.getNodeName() ) ) + { + result.add( item ); + } + } + return result; + } + + private static Node findSingleChild( Node node, String elementName ) + throws MojoExecutionException + { + List<Node> elementsByTagName = findNamedChild( node, elementName ); + if ( elementsByTagName.isEmpty() ) + { + return null; + } + if ( elementsByTagName.size() > 1 ) + { + throw new MojoExecutionException( "Multiple " + elementName + "in plugin-help.xml" ); + } + return elementsByTagName.get( 0 ); + } + + private void writeGoal( StringBuilder sb, String goalPrefix, Element mojo ) + throws MojoExecutionException + { + String mojoGoal = getValue( mojo, "goal" ); + Node configurationElement = findSingleChild( mojo, "configuration" ); + Node description = findSingleChild( mojo, "description" ); + if ( goal == null || goal.length() <= 0 || mojoGoal.equals( goal ) ) + { + append( sb, goalPrefix + ":" + mojoGoal, 0 ); + Node deprecated = findSingleChild( mojo, "deprecated" ); + if ( ( deprecated != null ) && isNotEmpty( deprecated.getTextContent() ) ) + { + append( sb, "Deprecated. " + deprecated.getTextContent(), 1 ); + if ( detail && description != null ) + { + append( sb, "", 0 ); + append( sb, description.getTextContent(), 1 ); + } + } + else if ( description != null ) + { + append( sb, description.getTextContent(), 1 ); + } + append( sb, "", 0 ); + + if ( detail ) + { + Node parametersNode = getSingleChild( mojo, "parameters" ); + List<Node> parameters = findNamedChild( parametersNode, "parameter" ); + append( sb, "Available parameters:", 1 ); + append( sb, "", 0 ); + + for ( Node parameter : parameters ) + { + writeParameter( sb, parameter, configurationElement ); + } + } + } + } + + private void writeParameter( StringBuilder sb, Node parameter, Node configurationElement ) + throws MojoExecutionException + { + String parameterName = getValue( parameter, "name" ); + String parameterDescription = getValue( parameter, "description" ); + + Element fieldConfigurationElement = null; + if ( configurationElement != null ) + { + fieldConfigurationElement = (Element) findSingleChild( configurationElement, parameterName ); + } + + String parameterDefaultValue = ""; + if ( fieldConfigurationElement != null && fieldConfigurationElement.hasAttribute( "default-value" ) ) + { + parameterDefaultValue = " (Default: " + fieldConfigurationElement.getAttribute( "default-value" ) + ")"; + } + append( sb, parameterName + parameterDefaultValue, 2 ); + Node deprecated = findSingleChild( parameter, "deprecated" ); + if ( ( deprecated != null ) && isNotEmpty( deprecated.getTextContent() ) ) + { + append( sb, "Deprecated. " + deprecated.getTextContent(), 3 ); + append( sb, "", 0 ); + } + if ( isNotEmpty( parameterDescription ) ) { + append( sb, parameterDescription, 3 ); + } + if ( "true".equals( getValue( parameter, "required" ) ) ) + { + append( sb, "Required: Yes", 3 ); + } + if ( ( fieldConfigurationElement != null ) && isNotEmpty( fieldConfigurationElement.getTextContent() ) ) + { + String property = getPropertyFromExpression( fieldConfigurationElement.getTextContent() ); + append( sb, "User property: " + property, 3 ); + } + + append( sb, "", 0 ); + } + + /** + * <p>Repeat a String <code>n</code> times to form a new string.</p> + * + * @param str String to repeat + * @param repeat number of times to repeat str + * @return String with repeated String + * @throws NegativeArraySizeException if <code>repeat < 0</code> + * @throws NullPointerException if str is <code>null</code> + */ + private static String repeat( String str, int repeat ) + { + StringBuilder buffer = new StringBuilder( repeat * str.length() ); + + for ( int i = 0; i < repeat; i++ ) + { + buffer.append( str ); + } + + return buffer.toString(); + } + + /** + * Append a description to the buffer by respecting the indentSize and lineLength parameters. + * <b>Note</b>: The last character is always a new line. + * + * @param sb The buffer to append the description, not <code>null</code>. + * @param description The description, not <code>null</code>. + * @param indent The base indentation level of each line, must not be negative. + */ + private void append( StringBuilder sb, String description, int indent ) + { + for ( String line : toLines( description, indent, indentSize, lineLength ) ) + { + sb.append( line ).append( '\n' ); + } + } + + /** + * Splits the specified text into lines of convenient display length. + * + * @param text The text to split into lines, must not be <code>null</code>. + * @param indent The base indentation level of each line, must not be negative. + * @param indentSize The size of each indentation, must not be negative. + * @param lineLength The length of the line, must not be negative. + * @return The sequence of display lines, never <code>null</code>. + * @throws NegativeArraySizeException if <code>indent < 0</code> + */ + private static List<String> toLines( String text, int indent, int indentSize, int lineLength ) + { + List<String> lines = new ArrayList<String>(); + + String ind = repeat( "\t", indent ); + + String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" ); + + for ( String plainLine : plainLines ) + { + toLines( lines, ind + plainLine, indentSize, lineLength ); + } + + return lines; + } + + /** + * Adds the specified line to the output sequence, performing line wrapping if necessary. + * + * @param lines The sequence of display lines, must not be <code>null</code>. + * @param line The line to add, must not be <code>null</code>. + * @param indentSize The size of each indentation, must not be negative. + * @param lineLength The length of the line, must not be negative. + */ + private static void toLines( List<String> lines, String line, int indentSize, int lineLength ) + { + int lineIndent = getIndentLevel( line ); + StringBuilder buf = new StringBuilder( 256 ); + + String[] tokens = line.split( " +" ); + + for ( String token : tokens ) + { + if ( buf.length() > 0 ) + { + if ( buf.length() + token.length() >= lineLength ) + { + lines.add( buf.toString() ); + buf.setLength( 0 ); + buf.append( repeat( " ", lineIndent * indentSize ) ); + } + else + { + buf.append( ' ' ); + } + } + + for ( int j = 0; j < token.length(); j++ ) + { + char c = token.charAt( j ); + if ( c == '\t' ) + { + buf.append( repeat( " ", indentSize - buf.length() % indentSize ) ); + } + else if ( c == '\u00A0' ) + { + buf.append( ' ' ); + } + else + { + buf.append( c ); + } + } + } + lines.add( buf.toString() ); + } + + /** + * Gets the indentation level of the specified line. + * + * @param line The line whose indentation level should be retrieved, must not be <code>null</code>. + * @return The indentation level of the line. + */ + private static int getIndentLevel( String line ) + { + int level = 0; + for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ ) + { + level++; + } + for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ ) + { + if ( line.charAt( i ) == '\t' ) + { + level++; + break; + } + } + return level; + } + + private static String getPropertyFromExpression( String expression ) + { + if ( expression != null && expression.startsWith( "${" ) && expression.endsWith( "}" ) + && !expression.substring( 2 ).contains( "${" ) ) + { + // expression="${xxx}" -> property="xxx" + return expression.substring( 2, expression.length() - 1 ); + } + // no property can be extracted + return null; + } +}
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor