Skip to content

spring-io/spring-antora-maven-plugins

Spring Antora Maven Plugins

antora-component-version-maven-plugin

This plugin defines Maven properties that can be used for generating an antora.yml. The antora.yml can be included using the Antora Collector Extension.

antora-component-version-maven-plugin Supported Attributes

Maven Property Name Antora Key Description

antora-component.version

version

Generates the Antora version attribute from the Maven version property by, if present, removing -SNAPSHOT.

antora-component.prerelease

prerelease

Generates the Antora prerelease attribute from the Maven version property:

  • 1.0.0-SNAPSHOT will result in the prerelease attribute being set to -SNAPSHOT

  • 1.0.0-M1 will result in the prerelease attribute being set to true

  • 1.0.0-RC1 will result in the prerelease attribute being set to true

  • 1.0.0 will result in the prerelease attribute being set to false

Configuring antora-component-version-maven-plugin

This section describes how to configure and use the antora-component-version-maven-plugin.

To start, define the plugin in your build:

pom.xml
<plugin>
    <groupId>io.spring.maven.antora</groupId>
    <artifactId>antora-component-version-maven-plugin</artifactId>
    <version>0.0.4</version>
    <executions>
      <execution>
        <goals>
          <goal>antora-component-version</goal>
        </goals>
      </execution>
    </executions>
</plugin>

Next, create a resource that will have Maven Filtering performed on it. The plugin adds the folder src/main/antora/resources as a filtered resource by default and we will use that location in our example. Alternatively, you can explicitly add Maven Filtering to any location and place it there.

Here is an example using the default location:

src/main/antora/resources/antora-resources/antora.yml
version: ${antora-component.version}
prerelease: ${antora-component.prerelease}
asciidoc:
  attributes:
    attribute-missing: 'warn'
# ... more attributes (possibly with values from other properties) as needed ...
Note
The folder antora-resources is used so that the Antora Collector Extension can import Antora resources without picking up any other resources your project may have (e.g. resources for your Java project).

Finally, you can generate the resource by invoking process-resources:

$ mvn process-resources; cat target/classes/antora-resources/antora.yml
...
version: 1.0.0
prerelease: -SNAPSHOT
asciidoc:
  attributes:
    attribute-missing: 'warn'

To use this with the Antora Collector Extension, you need to define the command in the collector configuration. For example:

antora.yml
name: data-commons
version: true
title: Spring Data Commons
nav:
  - modules/ROOT/nav.adoc
ext:
  collector:
    - run:
        command: mvnw -Pdocs process-resources
        local: true
      scan:
        dir: target/classes/antora-resources

antora-maven-plugin

This is no longer maintained. Please see https://gitlab.com/antora/antora-maven-plugin/-/tree/main/

About

Antora support for Maven based projects

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •