- Created by Robert Reiner, last modified on 26. Jul 2018
projectdoc Toolbox
Renders a link to an artifact stored on a Nexus server.
- Categories
- Tags
- Extension
- Since
- 1.0
The macro allows to render a link and/or a code fragment with the artifact as a Maven XML dependency snippet .
The artifact reference is provided by the user in the macro's body. The macro will create a link to the artifact on a Nexus server.
The macro body contains the reference to the artifact.
This is the rendered short link:
The rendered XML code looks like this:
In this example the title is a link to the artifact on the Nexus server.
Since projectdoc Toolbox version 1.11 this macro is part of the Information Systems Extension. Prior to that version the macro has been part of the projectdoc Toolbox.
The Since attribute above refers to the version of the extension, not to the version of the projectdoc Toolbox.
Body
The macro body contains the reference information either as a short descriptor ID or as a Maven XML dependency snippet .
If the body is empty, the artifact coordinates have to be defined via space properties:
- Project Group ID (since version 1.8.0 defaults to
project.groupId
) - Project Artifact ID (since version 1.8.0 defaults to
project.artifactId
) - Project Type (optional)
- Project Version (since version 1.8.0 defaults to
project.version
) - Project Classifier (optional)
Descriptor ID
Provide the artifact coordinates in the colon-separated short format.
The format is groupId:artifactId:type:version:classifier
, where type
and classifier
are optional.
Here are two examples:
commons-lang:commons-lang:2.6
commons-lang:commons-lang:jar:2.6:sources
Dependency XML
Provide the artifact coordinates in the Maven Dependency XML format. Here are two examples:
<dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency>
<dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <type>jar</type> <version>2.6</version> <classifier>sources</code> </dependency>
Properties
System Identifier
The system identifier references the connection information to the server. The information is either specified via Confluence's Shortcut Links or via Space Properties.
The system identifier is checked at three locations
Typically do not change the system identifier provided by the macro (if one is specified). Keep the default value of 'nexus
' as long as you do not need to reference multiple server of the same type in one space. Then set the space property to reference the specific server accordingly. This makes it easier to create new links to artifacts since the system identifier need not to be changed.
The search for the system connection information is conducted as follows. Use the URI discovered first to connect to the server.
- Check for a space property
url-nexus
- Check for a space property
nexus
Only available with projectdoc Toolbox version 1.11 and up! - Check for a space property
shortcut-id-
.nexus
Lookup the connection information from the shortcut links with the value retrieved from the space property. - Check the shortcut links for a value
nexus
. - Check application navigator for a value
nexus
.
If no value is specified at any of the locations above, the macro renders an error message like this:
In this example for a system macro the referenced, but undefined system, is called test-repo
.
Nexus Repository ID
Identifies the repository within the Nexus server to reference the artifact.
Please note that this value is not used, if the space property Nexus Service is specified. The value may be left blank. In this case the value of the space property Nexus Default Repo ID is used. If the value is not set, the default central
is assumed.
There are special identifiers that control the way the URL to the artifact is constructed.
Repo ID | Since | Description | Example | Notes |
---|---|---|---|---|
* | < 1.0 | Path to the artifact |
https://repo1.maven.org/maven2/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
| Prior to the extension this feature has been provided with version 1.8 of the projectdoc Toolbox. |
$ | 1.0 | Query to Search Central |
http://search.maven.org/remotecontent?filepath=commons-lang/commons-lang/2.6/commons-lang-2.6.jar | - |
<char> | < 1.0 | Query to a Nexus server |
https://www.example.com/nexus/service/local/artifact/maven/redirect?r=central&g=commons-lang&a=commons-lang&v=2.6&e=jar
| The default URL construction mode. |
Render Link
Check to render a simple link to the artifact on the Nexus server. If unchecked the link is not rendered.
Label
The label to be rendered for the link. If Render Link is unchecked, the label is not used.
If the label starts with a question mark ('?
'), the label is considered to be a pattern. The five coordinates are recognized and translated to their artifact property values.The values are separated by colons (':
').
Part | Description |
---|---|
g | The group identifier (groupId ) of the artifact. |
a | The identifier (artifactId ) of the artifact. |
t | The type of the artifact (e.g. 'jar '). |
v | The version of the artifact. |
c | The classifier of the artifact. |
All other characters are ignored.
Pattern | Description |
---|---|
?v | Renders the version of the artifact |
?gav | Renders the group identifier, artifact identifier and version, separated by colons. |
Render XML Snippet
Check to render the reference as a Maven XML dependency. If unchecked this information is not rendered.
Plain XML
If unchecked, the XML is rendered within the Code Block Macro (only then do the code attributes apply). Otherwise it is rendered as plain XML fragment.
If Render XML Snippet is unchecked, this value is not used.
Is Library
If selected the reference links to a library, otherwise a plugin is assumed. This selection makes a difference if an XML fragment is rendered.
If the option is checked, the XML block for the artifact coordinates will be rendered as
<dependency> <groupId>de.smartics.maven.plugin</groupId> <artifactId>smartics-jboss-modules-maven-plugin</artifactId> <version>2.0.0</version> </dependency>
If unchecked, the result is rendered as follows:
<plugin> <groupId>de.smartics.maven.plugin</groupId> <artifactId>smartics-jboss-modules-maven-plugin</artifactId> <version>2.0.0</version> </plugin>
Code Title
If XML is rendered not in plain text, this value is passed to the Code Block Macro.
Also allows the pattern syntax for the label (e.g. "?gav
") to be passed as title to the code macro. See Label for details.
Additionally the title may be enclosed in square brackets. In this case the title is rendered as a link. This may be combined with the GAV pattern (e.g. "[?gav]
").
Code Theme
If XML is rendered not in plain text, this value is passed to the Code Block Macro.
Code Line Numbers
If XML is rendered not in plain text, this value is passed to the Code Block Macro.
Code First Line
If XML is rendered not in plain text, this value is passed to the Code Block Macro.
Code Collapse
If XML is rendered not in plain text, this value is passed to the Code Block Macro.
Details
Space Properties
The macro uses the following Space Properties:
Property Name | Description | Default Value |
---|---|---|
Nexus Service | The path on the Nexus server to the service that provides access to the artifacts | /service/local/artifact/maven/redirect?r=central |
url-(systemId) | The URL to the Nexus server. For details please refer to System Identifier. | none |
shortcut-id-(systemId) | The property allows to map the System Identifier to another value for lookup in Confluence's shortcuts. | nexus |
Nexus Default Repo ID | The default repository identifier to be used for the artifact service (value for parameter ' From version 1.8.0 a value of '*' switches to construct a path to the artifact relative to the repository (instead of the Nexus root). That is, if your path look like | central |
Autoconvert
To create the macro authors may simply paste the URI to the artifact on a Nexus server to the editor.
All is needed is a configuration of the Nexus base URI. For more information on this topic, please refer to Autoconvert Information System URIs.
Related macros
The following macros help with referencing resources on other information servers:
- Enterprise Architect Image Link Macro
- Renders an image generated from an Enterprise Architect diagram, transcluded from a server.
- HTML Snippet Macro
- Transclude HTML content from a remote server.
- Javadoc Link Macro
- Links API documentation pages for Java elements.
- System Image Link Macro
- Renders an image transcluded from a remote server.
- System Link Macro
- Links to a resource on a server.
- System Transclusion Macro
- Transclude content from a resource from a remote system.
- Text Snippet Macro
- Transclude text content from a remote server.