Appearance
Codespace Configuration
- Gradle Configuration
- NPM Configuration
- Maven Configuration
- Conan Configuration
- PyPI Configuration
- Curl
- Git LFS Configuration
- Other Package Managements Configuration
- Pipeline Configuration
Below are guide and examples on how to configure codespace for several tech stacks. Please follow according to your project requirements.
Gradle Configuration
This section covers the configuration required to use Gradle with JFrog Artifactory.
Main Public Repositories:
https://jfrog.ford.com/artifactory/external-proxy-group/https://jfrog.ford.com/artifactory/public-maven-ford/
1. Gradle Wrapper Configuration
File: gradle/wrapper/gradle-wrapper.properties
Configure the distribution URL to point to the internal Artifactory.
properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
# Update the version according to your project need
distributionUrl=https\://jfrog.ford.com/artifactory/gradle-distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists2. Settings Configuration
File: settings.gradle
Configure plugin management repositories to resolve Gradle plugins from Artifactory.
groovy
pluginManagement {
repositories {
maven {
url "https://jfrog.ford.com/artifactory/external-proxy-group/"
credentials {
username = System.getenv("ARTIFACTORY_USER")
password = System.getenv("ARTIFACTORY_PASSWORD")
}
}
maven {
url "https://jfrog.ford.com/artifactory/public-maven-ford/"
credentials {
username = System.getenv("ARTIFACTORY_USER")
password = System.getenv("ARTIFACTORY_PASSWORD")
}
}
}
}
rootProject.name = '<your-root-project>'3. Build Configuration
File: build.gradle
This example includes configuration for both resolving dependencies and publishing artifacts.
groovy
plugins {
id 'java'
id 'maven-publish'
id 'org.springframework.boot' version '3.2.8'
id 'gradle-boost' version '5.2.0'
id 'org.sonarqube' version '5.0.0.4638'
id 'jacoco'
id 'com.google.cloud.tools.jib' version '3.4.3'
id 'com.jfrog.artifactory' version '5.+' // Required for publishing to JFrog
}
group = 'com.ford.yourproject'
version = gradleBoost.fn.gitVersion()
println "Build Version = ${version ?: '[none]'}"
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
apply plugin: "com.jfrog.artifactory" // Required for publishing to JFrog
// Optional: Repositories for dependency resolution
repositories {
maven {
url "https://jfrog.ford.com/artifactory/external-proxy-group/"
credentials {
username = System.getenv("ARTIFACTORY_USER")
password = System.getenv("ARTIFACTORY_PASSWORD")
}
}
maven {
url "https://jfrog.ford.com/artifactory/public-maven-ford/"
credentials {
username = System.getenv("ARTIFACTORY_USER")
password = System.getenv("ARTIFACTORY_PASSWORD")
}
}
}
// Optional: Gradle Boost configuration
gradleBoost {
dependencies {
defaultRepositories = {}
}
}
// Required: Define what to publish
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact source: bootJar, extension: 'jar' // Optional: Publish bootJar
}
}
}
// Required: Artifactory plugin configuration
artifactory {
contextUrl = 'https://jfrog.ford.com/artifactory'
publish {
repository {
repoKey = '<your-jfrog-repo>'
username = System.getenv("ARTIFACTORY_USER")
password = System.getenv("ARTIFACTORY_PASSWORD")
}
defaults {
publications('mavenJava')
publishBuildInfo = false
publishArtifacts = true
publishPom = true
}
}
clientConfig.info.setProject('<project-key>') // Project key from JFrog "Project Overview"
}
dependencies {
testImplementation 'junit:junit:4.7'
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}4. Publishing to JFrog Artifactory
To publish artifacts, run the following command in your terminal.
Note: Publishing artifacts only works for local repository types.
Windows:
powershell
> gradlew artifactoryPublishUnix/Linux/macOS:
bash
> ./gradlew artifactoryPublishReference:
NPM (.npmrc/.yarnrc) Configuration
- .npmrc/.yarnrc example (project level):
email = CDSID@ford.com always-auth = true registry=https://jfrog.ford.com/artifactory/api/npm/npmjs/ //jfrog.ford.com/artifactory/api/npm/npmjs/:_authToken=${ARTIFACTORY_PASSWORD} - For Devenablement WAME template, Please follow Configuring JFrog Artifactory Environment Variables.
NPM Publish to JFrog Artifactory:
To publish your npm package to JFrog Artifactory, follow these steps:
Configure your package.json with the publishConfig:
json{ "name": "@your-scope/your-package", "version": "1.0.0", "publishConfig": { "registry": "https://jfrog.ford.com/artifactory/api/npm/<your-npm-repo>/" } }Ensure authentication is set up in your .npmrc file:
//jfrog.ford.com/artifactory/api/npm/<your-npm-repo>/:_authToken=${ARTIFACTORY_PASSWORD}Publish your package using the npm publish command:
bashnpm publishNote:
- Replace
<your-npm-repo>with your actual JFrog repository name (e.g.,npm-localfor local repositories). - Ensure the
ARTIFACTORY_PASSWORDenvironment variable is set with your JFrog API token or password. - Publishing only works with local repository types in JFrog Artifactory.
- For more information, visit JFrog NPM Registry Documentation.
- Replace
Maven Configuration
- Please read through the JFrog Artifactory Maven Guide.
An example of repositories within the settings.xml:
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<server>
<username>${security.getCurrentUsername()}</username>
<password>${security.getEscapedEncryptedPassword()!"*** Insert encrypted password here ***"}</password>
<id>central</id>
</server>
<server>
<username>${security.getCurrentUsername()}</username>
<password>${security.getEscapedEncryptedPassword()!"*** Insert encrypted password here ***"}</password>
<id>snapshots</id>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>dtande-releases</id>
<name>dtande-maven</name>
<url>https://jfrog.ford.com/artifactory/dtande-maven</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>dtande-maven</name>
<url>https://jfrog.ford.com/artifactory/dtande-maven</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>external-proxy-group</name>
<url>https://jfrog.ford.com/artifactory/external-proxy-group</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>external-proxy-group</name>
<url>https://jfrog.ford.com/artifactory/external-proxy-group</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>An example of repositories within the pom.xml:
<distributionManagement>
<repository>
<id>dtande-releases</id>
<name>dtande-releases</name>
<url>https://jfrog.ford.com/artifactory/dtande-maven</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>dtande--snapshots</name>
<url>https://jfrog.ford.com/artifactory/dtande-maven</url>
</snapshotRepository>
</distributionManagement>Conan Environment Configuration
This section covers the configuration required to use Conan with JFrog Artifactory.
1. Add Conan Remote
Add the JFrog Artifactory repository to your Conan client.
bash
conan remote add conan-io https://jfrog.ford.com/artifactory/api/conan/conan-io2. Authentication
Log in to the remote repository using your credentials.
bash
conan user -p <TOKEN> -r conan-io <CDSID>@ford.com3. Publish Conan Package
To upload a package to Artifactory, follow these steps:
Create the package (locally):
bashconan create . <user>/<channel>Example:
conan create . demo/testingUpload the package to the remote repository:
bashconan upload <package-name>/<version>@<user>/<channel> -r conan-io --allExample:
conan upload mypkg/1.0.0@demo/testing -r conan-io --all
Reference:
PyPI Environment Configuration
This section covers the configuration required to use PyPI (Python) with JFrog Artifactory.
1. Resolve Dependencies
File: ~/.pip/pip.conf (Unix/macOS) or %APPDATA%\pip\pip.ini (Windows)
Due to its design, pip does not support reading credentials from a separate file by default. Credentials can be supplied as part of the URL.
ini
[global]
index-url = https://<CDSID>@ford.com:<TOKEN>@jfrog.ford.com/artifactory/api/pypi/public-pypi-ford/simple2. Publish PyPI Packages
To upload packages to Artifactory, it is recommended to use twine and store credentials in a .netrc file.
Step 1: Configure .pypirc File: ~/.pypirc
Define your repository alias and URL.
ini
[distutils]
index-servers =
private-repository
[private-repository]
repository = https://jfrog.ford.com/artifactory/api/pypi/<your-pypi-repo>
username = $ARTIFACTORY_USER
password = $ARTIFACTORY_PASSWORDStep 2: Configure .netrc File: ~/.netrc (Unix/macOS) or %HOME%/_netrc (Windows)
Store your credentials securely. Ensure file permissions are restricted (e.g., chmod 600 ~/.netrc).
text
machine jfrog.ford.com
login <CDSID>@ford.com
password <TOKEN>Step 3: Install Twine Ensure you have twine installed for publishing.
bash
pip install twineStep 4: Build and Upload Build your package and upload it using the alias defined in .pypirc.
bash
# Build the package
py setup.py sdist bdist_wheel
# Upload to JFrog Artifactory
twine upload -r private-repository <PATH_TO_FILE>Reference:
Curl
An example of using curl to upload/deploy a file:
curl -L -u<CDSID>@ford.com:<TOKEN> -T <PATH_TO_FILE> "https://jfrog.ford.com/artifactory/sde-jenkins_tools-prod-local/<TARGET_FILE_PATH>"An example of using curl to download/retrieve a file:
curl -L -u<CDSID@ford.com:<TOKEN> -L -O "https://jfrog.ford.com/artifactory/sde-jenkins_tools-prod-local/<TARGET_FILE_PATH>"Git LFS Environment Configuration
The Git LFS client will ask for credentials (enter your Artifactory user name and token) for the Artifactory LFS repo when accessing it. To make the authentication process automatic you can use Git Credential Helpers to store these for you and have the Git LFS client authenticate automatically.
Other package managements Environment Configuration
For more package managements configuration, please visit JFrog Package Management.
Pipeline Configuration
For Pipeline Configuration, please see Jfrog Authentication Support for Pipelines