Skip to main content
Version: 1.1

Gradle tasks and dependency configurations

This section details the Gradle tasks available for building, testing, and deploying your ALFA project, as well as the dependency configurations used to manage external libraries. Understanding these tasks and configurations is crucial for efficiently managing your ALFA project's lifecycle.

Tasks

You can execute the following Gradle tasks from your IDE, the command line, or a build automation tool like Jenkins or Azure DevOps.

TaskDescription
buildAdsDockerImageBuilds a Docker image tagged <project-name>:latest in your local Docker registry utilizing ADS 1. Read the Build a Docker image section below for details.
buildAuthzDomainCompiles the authorization domain into a single YAML file (build/alfa/ads/domain.yaml) suitable for uploading to ADM or providing to ADS.
compileAlfaCompiles all ALFA policies to XACML and writes the output to build/alfa/domain/xacmlSpecifications.
compileAlfaToPackageCompiles all ALFA policies to XACML and bundles them into a policy package (build/alfa/domain/package/policy_package.zip), which you can upload to Axiomatics Services Manager (ASM).
dockerPreparePrepares the Docker build context in build/docker utilizing ADS 2.
installDeploymentDistPrepares the ADS 2 deployment within the build/install/deployment directory. This deployment package includes the ADS binaries, domain.yaml, deployment.yaml, the software license, and custom attribute connectors. This directory serves as the build context root directory for creating a container image using tools such as Docker, Buildah, Podman, Kaniko, or Buildkit.
runAdsRuns ADS 2 locally using the authorization domain from src/ and the deployment descriptor from deployment.yaml.
NOTE: You need a valid software license in license/ to run ADS.
Press Ctrl+C to stop the service.
IMPORTANT: Structure the deployment.yaml file according to the DomainOpens in a new tab section of the latest Access Decision Service documentation.
runAdsV1Runs ADS 1 locally using the authorization domain from src/ and the deployment descriptor from deployment.yaml.
NOTE: You need a valid software license in license/ to run ADS.
Press Ctrl+C to stop the service.
IMPORTANT: Structure the deployment.yaml file according to the Basic configuration > Domain section of the Access Decision Service 1.x documentation.
testRuns all unit, integration, and system tests and generates test reports in build/reports/tests/. The reports indicate which tests passed or failed and provide output and stack traces.

Build a Docker image with ADS 1

The project name is defined in your settings.gradle file:

settings.gradle
rootProject.name = 'my-alfa-project'

To push the image to a remote repository, tag it accordingly and then push it:

docker tag my-alfa-project:latest myRemoteRegistry.com/my-alfa-project:1.0
docker push myRemoteRegistry.com/my-alfa-project:1.0

The com.palantir.gradle.docker plugin builds the image using the Dockerfile in the project root, which you can customize as needed.

By default, the image includes everything required to run Access Decision Service (ADS): runtime dependencies, attribute connectors, custom code (src/main), license, deployment, and domain configuration.

note

Place any additional files in src/extra to include them in the image's current directory.

tip

To prevent ADS from using the domain and policy from the Git repository/pipeline, customize the Dockerfile and use an environment variable to configure ADS to retrieve an external domain (for example, through Authorization Domain Manager [ADM]).

Build a Docker image with ADS 2

Axiomatics Policy DevOps (APD) does not include a task for building a container image with ADS 2 binaries. Instead, use the installDeploymentDist task to prepare the build context in the build/install/deployment directory. Once prepared, call your preferred image build tool to create the image. The Dockerfile will be automatically copied into this build context directory.

Dependency configurations

Gradle's dependency configurations manage the classpath for different tasks. The following configurations help manage dependencies for your ALFA project:

ConfigurationDescription
pipAdd any extra attribute connector dependencies. This configuration already includes Axiomatics' Table, SQL, LDAP, HTTP, and Parser attribute connectors.
testImplementationAdd any additional dependencies required for executing tests.
adsCompileAdd any extra dependencies needed for compilation.
policyInclude any external ALFA policies.

To add a dependency, use the following syntax in your build.gradle file:

build.gradle
    dependencies {
pip '<group>:<name>:<version>'
}