Configure your Java build tool to use the Red Hat Lightwell Network repository

Configure your Java build tool to resolve dependencies through the Red Hat Lightwell Network repository by adding the repository to your existing build configuration.

Before you begin

About this task

Select the configuration method that matches your build tool.

Procedure

  • If you are using Apache Maven:
    1. Open your Maven settings.xml file.
    2. Add one of the following blocks inside your existing <profiles> section, and add the corresponding <activeProfile> entry inside your existing <activeProfiles> section. If your settings.xml file does not have these sections, add the entire block:
      Validated repository:
       <settings>
          <profiles>
            <profile>
              <id>lightwell-validated</id>
              <repositories>
                <repository>
                  <id>lightwell-validated</id>
                  <name>Red Hat Lightwell Network - Validated</name>
                  <url>https://packages.redhat.com/lightwell/java/validated</url>
                  <releases>
                    <enabled>true</enabled>
                  </releases>
                  <snapshots>
                    <enabled>false</enabled>
                  </snapshots>
                </repository>
              </repositories>
            </profile>
          </profiles>
          <activeProfiles>
            <activeProfile>lightwell-validated</activeProfile>
          </activeProfiles>
        </settings>
      Remediated repository:
       <settings>
          <profiles>
            <profile>
              <id>lightwell-remediated</id>
              <repositories>
                <repository>
                  <id>lightwell-remediated</id>
                  <name>Red Hat Lightwell Network - Remediated</name>
                  <url>https://packages.redhat.com/lightwell/java/remediated</url>
                  <releases>
                    <enabled>true</enabled>
                  </releases>
                  <snapshots>
                    <enabled>false</enabled>
                  </snapshots>
                </repository>
              </repositories>
            </profile>
          </profiles>
          <activeProfiles>
            <activeProfile>lightwell-remediated</activeProfile>
          </activeProfiles>
        </settings>
      
    3. Add a <server>block inside the <servers> section of your settings.xml file to configure authentication. The <id> must match the repository <id> in your profile. If your settings.xml file does not have a <servers> section, add one.
      Validated repository:
      <servers> 
          <server> 
              <id>lightwell-validated</id> 
              <username><service_account_username></username> 
              <password><service_account_token></password> 
          </server>
      </servers>
      Remediated repository
      <servers> 
          <server> 
              <id>lightwell-remediated</id> 
              <username><service_account_username></username> 
              <password><service_account_token></password> 
          </server> 
      </servers>

      where:

      <service_account_username>:  Specifies your registry service account username in the format XXXXXXX|service-account-name

      <service_account_token>:  Specifies your registry service account token.

    4. Save the file.
    5. To switch to the other repository tier, replace the block with the one for the other tier.
  • If you are using Gradle:
    1. Open your build.gradle file.
    2. Add the following repositories block. Ensure the Red Hat Lightwell Network repository is placed above mavenCentral() to prioritize patched versions:
      Validated repository:
       repositories {
            maven {
                name = "lightwell-validated"
                url "https://packages.redhat.com/lightwell/java/validated"
                credentials { 
                     username = "<service_account_username>"
                     password = "<service_account_token>"
                  }
            mavenCentral()
        }
      
      Remediated repository
      repositories {
            maven {
                name = "lightwell-remediated"
                url "https://packages.redhat.com/lightwell/java/remediated"
                credentials { 
                     username = "<service_account_username>"
                     password = "<service_account_token>"
                  }
            }
            mavenCentral()
        }

      where:

      <service_account_username>: Specifies your registry service account username in the format XXXXXXX|service-account-name.

      <service_account_token>: Specifies your registry service account token

      To use the validated repository instead, replace remediated with validated in the URL.

    3. Save the file.

What to do next

  1. Run a build to confirm that dependencies resolve through the Red Hat Lightwell Network repository:

    For maven, run the following command:

    $ mvn dependency:resolve

    For Gradle, run the following command:

    $ gradle dependencies
  2. Verify that the build output shows artifacts resolving from the Red Hat Lightwell Network repository URL.
  3. If you are using the Remediated repository, add a remediated dependency to your project and verify that the resolved artifact includes the .rhlw-0000X version suffix, for example, 5.3.17.rhlw-00001.