Confluence Publisher
Version 0.30.2
The Confluence Publisher allows documentation written in AsciiDoc and versioned directly with the documented code base to be published to a Confluence space. It converts the resulting AsciiDoc HTML output to XHTML compatible with Confluence, manages included resources as Confluence attachments and ensures that only content modified since the last publication is again re-published.
The Confluence Publisher has been tested with Confluence Server 6.0.5 and Confluence Cloud.
Publishing to a locally installed Confluence instance might require the use of REST API v1 (see [restApiVersion] configuration property)
Supported Features
Currently, the Confluence Publisher supports the following AsciiDoc features:
The Confluence Publisher uses AsciidoctorJ and therefore supports documentation written using the Asciidoctor syntax. See Asciidoctor User Manual for more information about Asciidoctor.
Documentation Source Structure
The Confluence Publisher expects the AsciiDoc sources to be stored in a specific source structure. This source structure is used to derive the page hierarchy in Confluence.
<root>
+- top-level-page.adoc // top-level page AsciiDoc file
+- top-level-page // folder for sub-pages and resources of top-level page
+- sub-page-one.adoc // first sub page AsciiDoc file
+- sub-page-two.adoc // second sub page AsciiDoc file
+- sub-page-two // folder for sub-pages and resources of sub-page-two
+- any-other-folder // folder for additional files (e.g. images, PlantUML files, ...)
+- ...AsciiDoc files are expected to be encoded in UTF-8, unless explicitly configured to a different encoding. Resources like images, PlantUML files, other attachment types and include files can be placed in any location and are resolved relative to the location of the referencing AsciiDoc file. See Includes, Images and PlantUML for more information about resource file path resolution.
While the Confluence Publisher does not modify or delete pages outside the page tree structure defined by the ancestor id, it is recommended to use a separate Confluence space for published documentation and avoid manually adding or editing additional pages in that Confluence space.
In case multiple sources publish to the same Confluence space, ensure that each source uses its own ancestor id and that these ancestor ids are not in any parent-child relation.
Currently, the ordering of child pages cannot be influenced due to missing support in the Confluence REST API (see https://jira.atlassian.com/browse/CONFCLOUD-40101 and https://jira.atlassian.com/browse/CONFSERVER-40101 for information and voting)
Maven Plugin Configuration
The Confluence Publisher is configured with the help of a Maven plugin. A typical configuration could look like this:
pom.xml
<build>
<plugins>
<plugin>
<groupId>org.sahli.asciidoc.confluence.publisher</groupId>
<artifactId>asciidoc-confluence-publisher-maven-plugin</artifactId>
<version><!-- insert version here --></version>
<configuration>
<asciidocRootFolder>etc/docs</asciidocRootFolder>
<sourceEncoding>UTF-8</sourceEncoding> <!-- default -->
<rootConfluenceUrl>http://localhost:8090</rootConfluenceUrl>
<skipSslVerification>false</skipSslVerification>
<maxRequestsPerSecond>10</maxRequestsPerSecond>
<spaceKey>SPACE</spaceKey>
<ancestorId>327706</ancestorId>
<username>username</username> <!-- or read from property -->
<password>password</password> <!-- or read from property -->
<serverId>myServerId</serverId> <!-- requires server definition in settings.xml -->
<pageTitlePrefix xml:space="preserve">Doc :: </pageTitlePrefix>
<pageTitleSuffix xml:space="preserve"> [${project.version}]</pageTitleSuffix>
<versionMessage>Version ${project.version}</versionMessage>
<notifyWatchers>false</notifyWatchers>
<attributes>
<version>${project.version}</version>
<someOtherKey>value</someOtherKey>
</attributes>
</configuration>
</plugin>
</plugins>
</build>When relying on Maven support for encrypted credentials using the serverId configuration property, username and password need to be defined in settings.xml:
settings.xml
<settings>
...
<servers>
...
<server>
<id>myServerId</id>
<username>myusername</username>
<password>myEncryptedPassword</password>
</server>
...
</servers>
...
</settings>Configuration Property | Description | Constraint |
|---|---|---|
asciidocRootFolder | The documentation root folder with the AsciiDoc file structure. | mandatory |
sourceEncoding | The encoding of the AsciiDoc files. | optional (defaults to UTF-8) |
rootConfluenceUrl | The root URL of the Confluence instance to publish to.
| mandatory |
skipSslVerification | Defines whether to disable SSL certificate verification when connecting to Confluence via HTTPS while using self- signed certificates. | optional (defaults to |
enableHttpClientSystemProperties | Defines whether to enable support for configuring the underlying HTTP client using system properties passed to Maven.
Useful for configuring custom keys and trust stores for SSL.
| optional (defaults to |
maxRequestsPerSecond | Defines the number (positive integer or double) of REST API calls to execute within a second. | optional (defaults to no rate limit) |
connectionTimeToLive | Defines the time to live (TTL) for HTTP connections. Can be used to resolve problems with stale HTTP connections if the server uses a low TTL (<2000ms). | optional (defaults to infinite) |
spaceKey | The key of the Confluence space to publish to. | mandatory |
ancestorId | The id of the ancestor page under which the pages are appended. Be aware that publishing will remove all pages under the configured ancestor id that are not part of the published documentation ("orphaned pages"). | mandatory |
username | The username of the user to use for publishing.
| optional (unspecified behaves like an empty string, see password) |
password | The password of the user to use for publishing or a personal access token when the username is empty or unspecified.
| mandatory, if serverId is not specified |
serverId | The id of the server with username and encrypted password defined in settings.xml
| optional (defaults to not set, only supported for Maven plugin) |
publishingStrategy | The strategy to use when publishing to confluence. Possible values:
| optional (defaults to |
orphanRemovalStrategy | The strategy to use when detecting orphan pages (pages in Confluence not / no longer part of the documentation source structure) while publishing. Possible values:
| optional (defaults to |
versionMessage | The message that will be published with the changes into | optional (defaults to empty) |
notifyWatchers | Defines whether to notify page/space watchers upon changes when re-publishing. If set to | optional (defaults to true) |
attributes | User-defined attributes passed to AsciidoctorJ for replacing corresponding attribute placeholders.
| optional (default to empty) |
pageTitlePrefix | The prefix to be prepended to every page title.
| optional (defaults to empty) |
pageTitleSuffix | The suffix to be appended to every page title.
| optional (defaults to empty) |
skip | Defines whether the plugin execution should be skipped. | optional (defaults to |
convertOnly | Defines whether to only convert AsciiDoc sources, but not publish to Confluence (for checking documentation sanity without publishing). | optional (defaults to |
proxyScheme | The scheme (http or https) used to connect to a forward proxy (in case a forward proxy is required to access the Confluence instance). | optional (defaults to empty) |
proxyHost | The host of the forward proxy. | optional (defaults to empty) |
proxyPort | The port of the forward proxy. | optional (defaults to empty) |
proxyUsername | The username of the forward proxy (in case the forward proxy requires basic authentication). | optional (defaults to empty) |
restApiVersion | The version of the Confluence REST API to be used, either | optional (defaults to |