Configure your environment
Abstract
Chapter 1. Configure the Maven settings.xml file for the online repository
To use the Red Hat-hosted Quarkus repository with your Quarkus Maven project, configure the settings.xml file for your user. The configuration defines the Quarkus repository as a Maven profile and activates it so Maven can resolve Quarkus dependencies during builds.
When you configure the repository by modifying the Maven settings.xml file, the changes apply to all of your Maven projects. If you want to apply the configuration to a specific project only, use the -s option and specify the path to the project-specific settings.xml file.
Procedure
Open the Maven
$HOME/.m2/settings.xmlfile in a text editor or an integrated development environment (IDE).NoteIf no
settings.xmlfile is present in the$HOME/.m2/directory, copy thesettings.xmlfile from the$MAVEN_HOME/conf/directory into the$HOME/.m2/directory.Add the following Maven profile, which defines the Red Hat-hosted Quarkus repository, to the
<profiles>element of thesettings.xmlfile:<profile> <id>red-hat-enterprise-maven-repository</id> <repositories> <repository> <id>red-hat-enterprise-maven-repository</id> <url>https://maven.repository.redhat.com/ga/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>red-hat-enterprise-maven-repository</id> <url>https://maven.repository.redhat.com/ga/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile>Add the following lines to the
<activeProfiles>element of thesettings.xmlfile and save the file.<activeProfiles> <activeProfile>red-hat-enterprise-maven-repository</activeProfile> </activeProfiles>
Verification
Run mvn help:effective-settings. The output lists the Quarkus repository profile under <profiles> and shows it as active under <activeProfiles>.
Chapter 2. Configure the extension registry client
The extension registry, registry.quarkus.redhat.com, hosts the Quarkus extensions that Red Hat provides.
You can configure your Quarkus developer tools to access extensions in this registry by adding the registry to your registry client configuration file. The registry client configuration file is a YAML file that contains a list of registries.
-
The default Quarkus registry is
registry.quarkus.io; typically, you do not need to configure it. However, if a user provides a custom registry list andregistry.quarkus.iois not on it, thenregistry.quarkus.iois not enabled. - Ensure that the registry you prefer appears first on the registry list. When Quarkus developer tools search for registries, they begin at the top of the list.
Procedure
-
Open the
config.yamlfile that contains your extension registry configuration. When you configure your extension registries for the first time, you might need to create aconfig.yamlfile in the$HOME/.quarkusdirectory on your machine. Add the new registry to the
config.yamlfile. For example:config.yaml
registries: - registry.quarkus.redhat.com - registry.quarkus.io
2.1. Limit the extension catalog to a specific offering
The extension registry, registry.quarkus.redhat.com, hosts the definition of Quarkus extensions that Red Hat provides.
Extensions can be associated with multiple offerings; however, you can configure the extension registry to limit the extension catalog to a specific offering. You can configure only one offering per registry.
In the following example, the extension catalog provided by registry.quarkus.redhat.com is limited to extensions that make up the redhat offering.
If you do not configure an offering, the registry returns the complete extension catalog.
Procedure
-
Open the
config.yamlfile that contains your extension registry configuration. Add
offering: redhatto theconfig.yamlfile.For example:
config.yaml
registries: - registry.quarkus.redhat.com offering: redhat - registry.quarkus.io