Appearance
Codespace Configuration
- Gradle Configuration
- NPM Environment Configuration
- Maven Configuration
- Conan Environment Configuration
- PyPI Environment Configuration
- Curl
- Git LFS Environment Configuration
- Other package managements Environment 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
Gradle main public repositories for dependencies:
https://jfrog.ford.com/artifactory/external-proxy-group/
https://jfrog.ford.com/artifactory/public-maven-ford/
gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://jfrog.ford.com/artifactory/gradle-distributions/gradle-8.3-bin.zip // Update the version according to your project need
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
settings.gradle:
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>'
build.gradle (include publishing example):
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, depends on your project
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, depends on your project
gradleBoost {
dependencies {
defaultRepositories = {}
}
}
// required for publishing artifacts to Jfrog
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact source: bootJar, extension: 'jar' // optional
}
}
}
// only required for publishing to jfrog artifactory
artifactory {
contextUrl = 'https://jfrog.ford.com/artifactory' // The base Artifactory URL
publish {
repository {
repoKey = '<your-jfrog-repo>'
username=System.getenv("ARTIFACTORY_USER")
password=System.getenv("ARTIFACTORY_PASSWORD")
}
defaults {
// Reference to Gradle publications defined in the build script.
// This is how we tell the Artifactory Plugin which artifacts should be
// published to Artifactory.
publications('mavenJava')
publishBuildInfo = false // Publish build-info to Artifactory (true by default)
publishArtifacts = true // Publish artifacts to Artifactory (true by default)
publishPom = true // Publish generated POM files to Artifactory (true by default)
}
}
clientConfig.info.setProject('<project-key>') // project key can be found in Jfrog in "Project Overview" tab
}
dependencies {
testImplementation 'junit:junit:4.7'
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
Run gradle clean build from gitbash or terminal (from your project directory):
- Note: In your local environment, please make sure to remove your cached dependencies before doing your build, so it can cache down the new ones from ford jfrog.
- Windows: Navigate to "C:\Users\<CDSID>" and remove ".gradle" folder.
- MacOS/Linux: Navigate to "Users/<CDSID>/.gradle" and remove ".gradle" folder.
Windows:
> gradlew clean build
Unix:
> ./gradlew clean build
// optional cmd parameter for Gradle Wrapper credentials directly
> gradlew -Dgradle.wrapperUser=<CDSID>@ford.com -Dgradle.wrapperPassword=<TOKEN> clean build
Jfrog Artifactory Publish artifacts CMD:
- NOTE: Publish Artifacts only works for local repository type.
Windows:
> gradlew artifactoryPublish
Unix:
> ./gradlew artifactoryPublish
- Jfrog github repo example: Artifactory Gradle Plugin Publish
NPM Environment Configuration
Please follow Configuring JFrog Artifactory Environment Variables.
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
For your Conan command line client to work with this Conan repository, you first need to add the repository to your client configuration using the following command:
conan remote add conan-io https://jfrog.ford.com/artifactory/api/conan/conan-io
To login use the conan user command:
conan user -p <TOKEN> -r conan-io <CDSID>@ford.com
For more information on conan integrating with Jfrog, please visit Use Conan with Artifactory.
PyPI Environment Configuration
Due to its design, pip does not support reading credentials from a file. Credentials can be supplied as part of the URL. The password can be omitted (with the preceding colon), and in this case, the user will be prompted to enter credentials interactively.
- Example of ~/.pip/pip.conf:
[global]
index-url = https://<CDSID>@ford.com:<TOKEN>@jfrog.ford.com/artifactory/api/pypi/public-pypi-ford/simple
For more information on conan integrating with JFrog, please visit Use PyPI Credentials.
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