The MicroProfile Tutorial is a comprehensive guide for learning about MicroProfile. This repository contains both the documentation (built with Antora) and the source code examples for the tutorial.
- Whatβs New in MicroProfile 7.1 Tutorial
- Version and Branch Strategy
- Prerequisites
- Building the Documentation Site
- Running the Site Locally
- Development Workflow
- Understanding Antora Configuration
- Navigation and Site Structure
- About the fix-edit-links.sh Script
- Automating Repository URL Configuration
- Customizing the Documentation Site
- Getting Started
- Quick Links
- Repository Structure
- Prerequisites
- Quick Start
- Contributing
- License
- Community and Support
- Additional Resources
The MicroProfile Tutorial has been updated to reflect the latest features and changes in MicroProfile 7.1.
This repository uses a branch-per-version strategy to maintain documentation and code examples for different MicroProfile releases. Each MicroProfile version has its own dedicated branch, ensuring long-term maintainability and clear separation between versions.
We maintain separate branches for each MicroProfile version instead of using a single main branch because:
1. Long-term Version Maintenance
-
Each MicroProfile version follows its own lifecycle (6.1, 7.0, 7.1, 7.2, 8.0, etc.)
-
Versions may need independent bug fixes, clarifications, or dependency updates
-
With version-specific branches, we can update any version without affecting others
2. Clear Reference Points
-
Developers often work on projects locked to specific MicroProfile versions for compatibility
-
Stable branch URLs (e.g.,
tree/v6.1,tree/v7.1) provide permanent, bookmarkable references -
Users can easily find code examples matching their projectβs MicroProfile version
-
Documentation URLs remain stable even as new versions are released
3. Parallel Development
-
We can work on future versions (7.2, 8.0) while earlier versions are still stabilizing
-
Separate branches allow preview/beta content without disrupting stable documentation
-
Teams can contribute to different versions simultaneously
4. Easier Comparison & Migration
-
Branches make it trivial to compare differences between versions
-
Helps users understand breaking changes and migration paths (e.g.,
git diff v6.1 v7.1) -
Clear separation of version-specific code examples and API usage
5. Antora Multi-version Support
-
Antora is specifically designed to build documentation from multiple branches
-
Our build system automatically generates version-specific content (e.g.,
build/site/microprofile-tutorial/6.1/and7.1/) -
Users get a version selector in the UI to switch between versions seamlessly
6. Avoiding "Moving Target" Problem
-
If we used
mainfor 7.1 today, what happens when 7.2 ships? -
Version branches eliminate confusion about which version youβre looking at
-
Each branch represents a stable target for learners and enterprise users
| Branch | MicroProfile Version | Status |
|---|---|---|
|
6.1 |
Stable - maintenance mode |
|
7.1 |
Active development |
|
Landing/Navigation |
README and Antora configuration |
Future: |
7.2, 8.0 |
Not yet created |
Choose the branch that matches your MicroProfile version:
-
For MicroProfile 6.1 projects: Use the
v6.1branch -
For MicroProfile 7.1 projects: Use the
v7.1branch -
For the latest stable version: Check the badges or releases page
Branches (v6.1, v7.1) are living documentation:
-
Can be continuously updated with fixes, improvements, and clarifications
-
Antora builds the documentation site from these branches
-
Used for active development and ongoing maintenance
GitHub Releases (v6.1.0, v7.1.0) are immutable snapshots:
-
Mark official milestones (e.g., "Tutorial completed for MP 7.1")
-
Provide downloadable archives of specific versions
-
Useful for citations, training certifications, or enterprise policies
-
Created from branch tags at significant points
You can use both: follow a branch for the latest updates, or download a specific release for a fixed reference.
When creating documentation for a new MicroProfile version:
-
Create a new version branch from the most recent version:
git checkout v7.1 git checkout -b v7.2
-
Update version numbers throughout the branch:
-
antora.yml- Component version and display version -
All
pom.xmlfiles incode/directory - MicroProfile and dependency versions -
Documentation content referencing version numbers
-
-
Update code examples to use new MicroProfile features and APIs
-
Test the build locally before pushing:
antora antora-assembler.yml
-
Push the branch to the repository:
git push -u origin v7.2
-
Update
antora-assembler.ymlinmainbranch to include the new version in builds -
Create a GitHub Release when the version reaches a stable milestone
The antora-assembler.yml file is configured to build documentation for multiple versions simultaneously. This:
-
Creates a version selector in the documentation UI
-
Allows users to switch between different MicroProfile versions easily
-
Builds all versions from their respective branches in a single site
-
Maintains separate navigation and content for each version
You need to install Antora using npm. If you donβt have Node.js installed, you can install Node.js by following this instructions.
npm install -g @antora/cli @antora/site-generator-defaultFor the best experience editing AsciiDoc files in Visual Studio Code, we recommend installing the following extensions:
-
AsciiDoc extension by Asciidoctor (
asciidoctor.asciidoctor-vscode) - Provides rich language support for AsciiDoc -
Auto Open Preview Panel (
matt-rudge.auto-open-preview-panel) - Opens preview automatically when opening AsciiDoc files
You can build the site by running the following commands in the root directory of the project:
./update-repo-url.sh
antora antora-assembler.yml
./fix-edit-links.sh-
The first command ensures that the repository URLs are up-to-date.
-
The second command will generate the site in the
build/sitedirectory. -
The third command fixes the "Edit this Page" links to properly point to GitHub instead of local file paths.
Alternatively, you can use the following one-liner:
./update-repo-url.sh && antora antora-assembler.yml && ./fix-edit-links.shYou can run the site locally using Pythonβs built-in HTTP server. First, navigate to the build/site directory:
cd build/siteThen, run the following command:
python3 -m http.server 8080This will start a local server on port 8080. You can then open your web browser and navigate to http://<hostname>:8080 to view the site.
|
Tip
|
If port 8080 is already in use, you can free it by finding and stopping the process using it. For example, on Linux or macOS: + lsof -i :8080 kill <PID> Replace |
To streamline the development process, a development server script is included that can automatically rebuild the documentation when files change.
The dev-server.sh script provides three commands:
-
Build only:
./dev-server.sh build
This builds the documentation site once.
-
Build and serve:
./dev-server.sh serve
This builds the documentation site and starts a local HTTP server on port 8080.
-
Build, serve, and watch for changes:
./dev-server.sh watch
This builds the documentation site, starts a local HTTP server, and automatically rebuilds the site when files change.
The development server requires:
-
Python 3 (for the HTTP server)
-
inotify-tools (for file watching, will be automatically installed if missing)
-
Start the development server in watch mode:
./dev-server.sh watch -
Open your browser at http://localhost:8080
-
Edit AsciiDoc files in the
modules/ROOT/pages/directory -
Save your changes and see them automatically reflected in the browser
Antora uses several configuration files to manage the documentation site. The main files are:
-
antora-assembler.yml: The primary configuration file that defines the site structure, UI bundle, and supplemental files. -
antora.yml: Component configuration for the MicroProfile Tutorial, including metadata and edit URL configuration. -
supplemental-ui/: Directory containing customizations like favicons and custom partials.
The main configuration file for the site is antora-assembler.yml, which defines:
-
Site metadata: Title, URL, and starting page
-
Content sources: Where to find documentation content
-
UI bundle: The theme and UI components to use
-
Output: Where to generate the site
-
Asciidoc attributes: Global attributes for all pages
Hereβs a breakdown of the key sections:
site:
title: MicroProfile Tutorial
url: https://microprofile.io
start_page: microprofile-tutorial::index.adoc
keys:
show_edit_page_link: trueThe antora.yml file defines the documentation component:
name: microprofile-tutorial
title: MicroProfile Tutorial
version: 6.1
edit_url: https://github.com/microprofile/microprofile-tutorial/tree/main/modules/ROOT/pages/{path}
asciidoc:
attributes:
source-language: asciidoc@
table-caption: false
xrefstyle: full
nav:
- modules/ROOT/pages/nav.adoc
start_page: index.adocKey properties:
-
name: The component name used in xrefs and URLs
-
title: The human-readable title
-
version: The component version (appears in URLs and version selector)
-
edit_url: The URL template for "Edit this Page" links
-
nav: The navigation file(s) for the component
-
start_page: The default page when accessing the component root
The navigation is defined in modules/ROOT/pages/nav.adoc and uses AsciiDoc with special Antora directives:
* xref:index.adoc[Home]
* xref:chapter01/chapter01.adoc[Chapter 1: Introduction]
* Chapter 2: Getting Started
** xref:chapter02/chapter02-01.adoc[Section 2.1: Environment Setup]The navigation structure directly affects the sidebar menu in the generated site.
The navigation system in Antora is a critical component that determines how users find and access content. Understanding how navigation works can help you create a better user experience.
The MicroProfile Tutorial site navigation consists of:
-
Main Navigation: Defined in
modules/ROOT/pages/nav.adoc, controls the sidebar navigation. -
Breadcrumbs: Shows the current pageβs location in the content hierarchy.
-
Previous/Next Links: Helps users navigate sequentially through content.
-
Table of Contents: Generated from page headings, provides in-page navigation.
The navigation can be customized in several ways:
The main navigation structure is defined in modules/ROOT/pages/nav.adoc:
* xref:index.adoc[Home]
* xref:chapter01/chapter01.adoc[Chapter 1: Introduction]
* Chapter 2: Getting Started
** xref:chapter02/chapter02-01.adoc[Section 2.1: Environment Setup]
** xref:chapter02/chapter02-02.adoc[Section 2.2: First Steps]Navigation entries can be:
-
Direct links to pages (with
xref:) -
Unlinked category headers (without
xref:) -
Nested to create hierarchical structures (using multiple
*characters)
To customize the navigation appearance:
-
Style Overrides: Add CSS for navigation elements in your supplemental UI files.
-
Template Customization: Override the navigation templates in the UI bundle.
-
JavaScript Enhancements: Add interactive features like search, filtering, or collapsible sections.
Example CSS customization for navigation:
/* Customizing the sidebar navigation */
.nav-menu {
background-color: #f5f5f5;
}
.nav-item.is-current-page > .nav-link {
color: #0d5aa7;
font-weight: bold;
}-
Logical Organization: Group related content together in the navigation.
-
Consistent Naming: Use consistent naming conventions for pages and sections.
-
Limited Nesting: Avoid deep nesting (more than 3 levels) to prevent navigation complexity.
-
Descriptive Labels: Use clear, descriptive labels for navigation items.
-
Progressive Disclosure: Organize content from basic to advanced topics.
The UI bundle can be customized to include advanced navigation features:
-
Search Integration: Add search functionality to help users find content quickly.
-
Version Selector: Allow users to switch between different versions of the documentation.
-
Component Selector: If you have multiple components, provide a way to navigate between them.
-
Tag-Based Navigation: Group content by tags or categories for alternative navigation paths.
The fix-edit-links.sh script is a necessary post-processing step in the build process. Despite having edit_url properly configured in antora.yml, when building from a local repository (url: . in antora-assembler.yml), Antora generates edit links that point to local file paths instead of GitHub URLs.
The script performs a simple text replacement in the generated HTML files, replacing local file paths with proper GitHub repository URLs. This ensures that the "Edit this Page" links work correctly for users viewing the documentation.
If you update the repository URL or branch name, make sure to update the replacement URL in the fix-edit-links.sh script accordingly. The current implementation assumes the GitHub repository URL is https://github.com/microprofile/microprofile-tutorial and the branch is main.
To simplify the management of repository URLs across configuration files, the update-repo-url.sh script is provided. This script:
-
Automatically detects your Git repository URL and current branch
-
Updates the
edit_urlinantora.yml -
Updates the repository information in
fix-edit-links.sh
Run the script before building the documentation:
./update-repo-url.shThis ensures that both the Antora configuration and the fix-edit-links script use the same repository URL and branch, eliminating duplication and reducing the chance of errors.
When you clone the repository or switch branches, run this script to update the configuration automatically.
The MicroProfile Tutorial documentation site can be customized in various ways to enhance its appearance and functionality. Here are the key customization options:
Favicons are configured using the supplemental-ui/partials/head-meta.hbs file, which is included in the HTML <head> section of each page. The current setup includes:
-
An SVG favicon (primary)
-
A PNG favicon (fallback for browsers that donβt support SVG)
To change the favicons:
-
Replace the files in
supplemental-ui/img/:-
favicon.svg- Vector version of the favicon -
favicon.png- Bitmap version of the favicon
-
-
Make sure the references in
head-meta.hbsmatch your file names
The UI bundle is defined in antora-assembler.yml under the ui.bundle.url key. The current configuration uses a custom UI bundle from the microprofile-documentation-ui repository.
To apply additional customizations:
-
Add or modify files in the
supplemental-ui/directory:-
partials/- Override specific UI components -
css/- Add custom CSS styles -
js/- Add custom JavaScript
-
Common customizations include:
* Tutorial Documentation: Comprehensive learning materials built with Antora and deployed as a static site
* Source Code Examples: Practical MicroProfile e-commerce application code organized by chapter
* Two Specialized Guides:
- Contributors Guide (CONTRIBUTORS.adoc) - For documentation contributors
- Developers Guide (DEVELOPERS.adoc) - For application developers
Depending on your goals, choose the appropriate guide:
If you want to contribute to the documentation or help maintain the Antora-based documentation site:
π Read the Contributors Guide
The Contributors Guide covers:
-
Setting up the Antora documentation site
-
Building and running the documentation locally
-
Development workflow for documentation changes
-
Understanding Antora configuration
-
Customizing the documentation site
-
Deployment and hosting options
If you want to download and run the source code for the MicroProfile e-commerce application:
π» Read the Developers Guide
The Developers Guide covers:
-
How to download the source code
-
Setting up your development environment
-
Building and running the code for each chapter
-
Understanding the project structure
-
Working with individual microservices
-
Common development tasks and troubleshooting
-
Contributors Guide - Complete guide for documentation contributors
-
Antora Documentation - Official Antora documentation
-
modules/ROOT/pages/- Documentation source files -
antora-assembler.yml- Main Antora configuration file
-
Developers Guide - Complete guide for application developers
-
code/- Source code organized by chapter -
MicroProfile - Official MicroProfile documentation
-
Open Liberty Guides - Additional learning resources
microprofile-tutorial/
βββ CONTRIBUTORS.adoc # Guide for documentation contributors
βββ DEVELOPERS.adoc # Guide for application developers
βββ README.adoc # This file
βββ code/ # Source code examples by chapter
β βββ chapter02/ # Getting Started
β βββ chapter03/ # Persistence and Database
β βββ chapter04/ # Configuration
β βββ ... # Additional chapters
βββ modules/ROOT/ # Antora documentation content
β βββ pages/ # Documentation pages
βββ antora-assembler.yml # Antora site configuration
βββ antora.yml # Component configuration
βββ build/ # Generated documentation site (after build)-
Node.js (for Antora)
-
npm (comes with Node.js)
-
Antora CLI and Site Generator
See the Contributors Guide for detailed setup instructions.
-
Java Development Kit (JDK) 21 or later
-
Maven 3.13 or later
-
Git
See the Developers Guide for detailed setup instructions.
# Install Antora (first time only)
npm install -g @antora/cli @antora/site-generator-default
# Build the documentation site
./update-repo-url.sh && antora antora-assembler.yml && ./fix-edit-links.sh
# Run locally
cd build/site && python3 -m http.server 8080For more details, see the Contributors Guide.
# Clone the repository
git clone https://github.com/microprofile/microprofile-tutorial.git
cd microprofile-tutorial
# Navigate to a chapter (e.g., Chapter 2)
cd code/chapter02/mp-ecomm-store
# Run in development mode
mvn liberty:devFor more details, see the Developers Guide.
We welcome contributions to both the documentation and the code examples!
-
Documentation Contributions: See the Contributors Guide
-
Code Contributions: See the Developers Guide
Please ensure your contributions follow the existing patterns and include appropriate tests or validation.
This project is licensed under the terms specified in the LICENSE file.
-
MicroProfile Website: https://microprofile.io
-
MicroProfile Google Group: https://groups.google.com/forum/#!forum/microprofile
-
Open Liberty: https://openliberty.io
-
Jakarta EE: https://jakarta.ee