{"id":31769961,"url":"https://github.com/jfrog/artifactory-client-java","last_synced_at":"2025-12-18T01:27:09.025Z","repository":{"id":4072022,"uuid":"5176685","full_name":"jfrog/artifactory-client-java","owner":"jfrog","description":"Artifactory REST Client Java API bindings","archived":false,"fork":false,"pushed_at":"2025-09-23T06:21:36.000Z","size":1871,"stargazers_count":324,"open_issues_count":35,"forks_count":157,"subscribers_count":50,"default_branch":"master","last_synced_at":"2025-09-23T08:14:04.714Z","etag":null,"topics":["artifactory","artifactory-java-client","java","jfrog","jfrog-artifactory","jfrog-xray","xray"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jfrog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2012-07-25T08:37:56.000Z","updated_at":"2025-09-23T06:18:41.000Z","dependencies_parsed_at":"2025-07-25T12:30:14.189Z","dependency_job_id":"2ac2445b-6ea1-4d54-91dd-13dfc28956c9","html_url":"https://github.com/jfrog/artifactory-client-java","commit_stats":{"total_commits":615,"total_committers":79,"mean_commits":7.784810126582278,"dds":0.8943089430894309,"last_synced_commit":"31febf85a752c7946ec0b76ac4349c921342d3de"},"previous_names":["jfrogdev/artifactory-client-java"],"tags_count":55,"template":false,"template_full_name":null,"purl":"pkg:github/jfrog/artifactory-client-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfrog%2Fartifactory-client-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfrog%2Fartifactory-client-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfrog%2Fartifactory-client-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfrog%2Fartifactory-client-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jfrog","download_url":"https://codeload.github.com/jfrog/artifactory-client-java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfrog%2Fartifactory-client-java/sbom","scorecard":{"id":68835,"data":{"date":"2025-08-04","repo":{"name":"github.com/jfrog/artifactory-client-java","commit":"3f339cf04bf57fb6741c72b41d6c6ed447e3e136"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":3.5,"checks":[{"name":"Code-Review","score":4,"reason":"Found 13/30 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":0,"reason":"dangerous workflow patterns detected","details":["Warn: untrusted code checkout '${{ github.event.pull_request.head.sha }}': .github/workflows/tests.yml:28"],"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/cla.yml:1","Warn: no topLevel permission defined: .github/workflows/monitorISsues.yml:1","Warn: no topLevel permission defined: .github/workflows/removeLabel.yml:1","Warn: no topLevel permission defined: .github/workflows/tests.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"name":"Maintained","score":4,"reason":"5 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/cla.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/jfrog/artifactory-client-java/cla.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/cla.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/jfrog/artifactory-client-java/cla.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/monitorISsues.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/jfrog/artifactory-client-java/monitorISsues.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/removeLabel.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/jfrog/artifactory-client-java/removeLabel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/jfrog/artifactory-client-java/tests.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/jfrog/artifactory-client-java/tests.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/jfrog/artifactory-client-java/tests.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/jfrog/artifactory-client-java/tests.yml/master?enable=pin","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/jfrog/.github/SECURITY.md:1","Info: Found linked content: github.com/jfrog/.github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/jfrog/.github/SECURITY.md:1","Info: Found text in security policy: github.com/jfrog/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 15 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-15T03:19:46.609Z","repository_id":4072022,"created_at":"2025-08-15T03:19:46.609Z","updated_at":"2025-08-15T03:19:46.609Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002527,"owners_count":26083403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artifactory","artifactory-java-client","java","jfrog","jfrog-artifactory","jfrog-xray","xray"],"created_at":"2025-10-10T02:55:57.192Z","updated_at":"2025-10-10T02:55:59.664Z","avatar_url":"https://github.com/jfrog.png","language":"Java","readme":"\u003cdiv align=\"center\"\u003e\n\n# Artifactory Java Client\n\n[![Scanned by Frogbot](https://raw.github.com/jfrog/frogbot/master/images/frogbot-badge.svg)](https://github.com/jfrog/frogbot#readme)\n\n| Branch |Status|\n|:------:|:---:|\n|master|[![Test](https://github.com/jfrog/artifactory-client-java/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/jfrog/artifactory-client-java/actions/workflows/tests.yml?query=branch%3Amaster)\n|dev|[![Test](https://github.com/jfrog/artifactory-client-java/actions/workflows/tests.yml/badge.svg?branch=dev)](https://github.com/jfrog/artifactory-client-java/actions/workflows/tests.yml?query=branch%3Adev)\n\n\u003c/div\u003e\n\nArtifactory Java client provides simple yet powerful Artifactory connection and management within your Java code.\n\nThe client allows managing Artifactory repositories, users, groups, permissions and system configuration. It also allows\nsearches, upload and download artifacts to or from Artifactory and a lot more.\n\n## Table of Contents\n\n- [Getting Started](#getting-started)\n    - [Add artifactory-java-client-services as a dependency to your build script](#add-artifactory-java-client-services-as-a-dependency-to-your-build-script)\n    - [Examples](#examples)\n        - [Setting up Artifactory](#setting-up-artifactory)\n        - [Uploading and downloading artifacts](#uploading-and-downloading-artifacts)\n        - [File, Folder and Repository Info](#file-folder-and-repository-info)\n        - [Search](#search)\n        - [Builds](#builds)\n        - [Managing Items (files and folders)](#managing-items-files-and-folders)\n        - [Managing Repositories](#managing-repositories)\n        - [Managing Users](#managing-users)\n        - [Managing User Groups](#managing-user-groups)\n        - [Permissions](#permissions)\n        - [System](#system)\n        - [Rest API](#rest-api)\n- [Building and Testing the Sources](#building-and-testing-the-sources)\n- [Example Projects](#example-projects)\n- [Contributing Code](#contributing-code)\n- [License](#license)\n- [Release Notes](#release-notes)\n\n## Getting Started\n\n### Add *artifactory-java-client-services* as a dependency to your build script.\n\n#### Maven\n\nAdd the following dependency to your `pom.xml` file:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.jfrog.artifactory.client\u003c/groupId\u003e\n    \u003cartifactId\u003eartifactory-java-client-services\u003c/artifactId\u003e\n    \u003cversion\u003eRELEASE\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n#### Gradle\n\nAdd the following snippets to your `build.gradle` file:\n\n```groovy\nrepositories {\n    mavenCentral()\n}\ndependencies {\n    compile 'org.jfrog.artifactory.client:artifactory-java-client-services:+'\n}\n```\n\n### Examples:\n\nThis section includes a few usage examples of the Java client APIs from your application code.\n\n#### Setting up Artifactory\n\n```groovy\nArtifactory artifactory = ArtifactoryClientBuilder.create()\n        .setUrl(\"ArtifactoryUrl\")\n        .setUsername(\"username\")\n        .setPassword(\"password\")\n        .build();\n```\n\nTrusting your own self-signed certificates without ignoring any SSL issue:\n\n```groovy\nArtifactory artifactory = ArtifactoryClientBuilder.create()\n        .setUrl(\"ArtifactoryUrl\")\n        .setUsername(\"username\")\n        .setPassword(\"password\")\n        .setSslContextBuilder(SSLContexts.custom()\n                .loadTrustMaterial(\u003c your trust strategy here \u003e))\n        .build();\n```\n\nAdding a request interceptor for logging or modifying outgoing requests:\n\n```groovy\nArtifactory artifactory = ArtifactoryClientBuilder.create()\n        .setUrl(\"ArtifactoryUrl\")\n        .setUsername(\"username\")\n        .setPassword(\"password\")\n        .addInterceptorLast((request, httpContext) -\u003e {\n            System.out.println(\"Artifactory request: \" + request.getRequestLine());\n        })\n        .build();\n```\n\nUsing HTTP proxy:\n\n```groovy\nProxyConfig proxy = new ProxyConfig();\nproxy.setHost(\"localhost\");\nproxy.setPort(9090);\nArtifactory artifactory = ArtifactoryClientBuilder.create()\n        .setUrl(\"ArtifactoryUrl\")\n        .setUsername(\"username\")\n        .setPassword(\"password\")\n        .setProxy(proxy)\n        .setNoProxyHosts(\".gom.com,*.jfrog.com,.not.important.host:443\")\n        .build();\n```\n**NOTE:** If hosts to ignore proxy are not set through \"setNoProxyHosts(String noProxyHosts)\" method,\nthey are set through NO_PROXY env variable.\n\n#### Uploading and downloading artifacts\n\n\n##### Uploading an Artifact\n* Using java.io.File as source:\n     ```groovy\n     java.io.File file = new java.io.File(\"fileToUpload.txt\");  \n     File result = artifactory.repository(\"RepoName\").upload(\"path/to/newName.txt\", file).doUpload();\n     ```\n* Using an InputStream as source:\n     ```groovy\n     try (InputStream inputStream = Files.newInputStream(Paths.get(\"fileToUpload.txt\"))) {\n         File result = artifactory.repository(\"RepoName\").upload(\"path/to/newName.txt\", inputStream).doUpload();\n     }\n     ```\n\n##### Upload and explode an Archive\n\n```groovy\njava.io.File file = new java.io.File(\"fileToUpload.txt\");\nFile result = artifactory.repository(\"RepoName\").upload(\"path/to/newName.txt\", file).doUploadAndExplode(true)\n```\n\n##### Uploading an Artifact with Properties\n\n```groovy\njava.io.File file = new java.io.File(\"fileToUpload.txt\");\nFile deployed = artifactory.repository(\"RepoName\")\n        .upload(\"path/to/newName.txt\", file)\n        .withProperty(\"color\", \"blue\")\n        .withProperty(\"color\", \"red\")\n        .doUpload();\n```\n\n##### Uploading and Artifact with an UploadListener\nCan be used for tracking the progress of the current upload:\n```groovy\njava.io.File file = new java.io.File(\"fileToUpload.txt\");  \nFile result = artifactory.repository(\"RepoName\")\n        .upload(\"path/to/newName.txt\", file)\n        .withListener((bytesRead, totalBytes) -\u003e {\n            System.out.println(\"Uploaded \" + format.format((double) bytesRead / totalBytes));\n        })\n        .doUpload();\n```\nThe code snippet above would print the percentage of the current upload status.\n\n**Important:** The totalBytes is calculated from the size of the input File. In case the source is a `java.io.File` object, the upload will use the `File.length()` to determine the total number of bytes. If the source is an `InputStream`, the total size of the upload must be specified using the `withSize(long size)` method.\ne.g.:\n```groovy\nPath sourceFile = Paths.get(\"fileToUpload.txt\");\ntry (InputStream inputStream = Files.newInputStream(sourceFile)) {\n        File result = artifactory.repository(\"RepoName\")\n                .upload(\"path/to/newName.txt\", inputStream)\n                .withSize(Files.size(sourceFile))\n                .withListener((bytesRead, totalBytes) -\u003e {\n                    System.out.println(\"Uploaded \" + format.format((double) bytesRead / totalBytes));\n                })\n                .doUpload();\n    }\n```\n\n\n##### Copy an Artifact by SHA-1\n\n```groovy\njava.io.File file = new java.io.File(\"fileToUpload.txt\");\nString sha1 = calcSha1(file)\n\nFile deployed = artifactory.repository(\"RepoName\")\n        .copyBySha1(\"path/to/newName.txt\", sha1)\n        .doUpload();\n```\n\n##### Downloading an Artifact\n\n```groovy\nInputStream iStream = artifactory.repository(\"RepoName\")\n        .download(\"path/to/fileToDownload.txt\")\n        .doDownload();\n```\n\n##### Downloading an Artifact with [non-mandatory Properties](https://www.jfrog.com/confluence/display/RTF4X/Using+Properties+in+Deployment+and+Resolution#UsingPropertiesinDeploymentandResolution-Non-mandatoryProperties)\n\n```groovy\nInputStream iStream = artifactory.repository(\"RepoName\")\n        .download(\"path/to/fileToDownload.txt\")\n        .withProperty(\"colors\", \"red\")\n        .doDownload();\n```\n\n##### Downloading Artifact with [mandatory properties](https://www.jfrog.com/confluence/display/RTF4X/Using+Properties+in+Deployment+and+Resolution#UsingPropertiesinDeploymentandResolution-MandatoryProperties)\n\n```groovy\nInputStream iStream = artifactory.repository(\"RepoName\")\n        .download(\"path/to/fileToDownload.txt\")\n        .withMandatoryProperty(\"colors\", \"red\")\n        .doDownload();\n```\n\n##### Downloading Artifact with custom headers\n\n```groovy\nMap\u003cString, String\u003e headers = new HashMap\u003c\u003e();\nheaders.put(\"Range\", \"bytes=0-10\");\nInputStream iStream = artifactory.repository(\"RepoName\")\n        .download(\"path/to/fileToDownload.txt\")\n        .doDownloadWithHeaders(headers);\n```\n\n#### File, Folder and Repository Info\n\n##### File Info\n\n```groovy\nFile file = artifactory.repository(\"RepoName\").file(\"path/to/file.txt\").info();\nboolean isFile = file.isFolder();\nlong fileSize = file.getSize();\nString fileUri = file.getDownloadUri();\nString md5Checksum = file.getChecksums().getMd5();\nString sha1Checksum = file.getChecksums().getSha1();\nString sha2Checksum = file.getChecksums().getSha256();\n```\n\n##### Folder Info\n\n```groovy\nFolder folder = artifactory.repository(\"RepoName\").folder(\"path/to/folder\").info();\nboolean isFolder = folder.isFolder();\nString repoName = folder.getRepo();\nString folderPath = folder.getPath();\nint childrenItemsSize = folder.getChildren().size();\n```\n\n##### Repository Info\n\n```groovy\nRepository repo = artifactory.repository(\"RepoName\").get();\nString repoKey = repo.getKey();\nString desc = repo.getDescription();\nString layout = repo.getRepoLayoutRef();\nRepositoryType repoClass = repo.getRclass();\n\nRepositorySettings settings = repo.getRepositorySettings();\nPackageType packageType = settings.getPackageType();\n\nif (PackageType.bower == packageType) {\n    BowerRepositorySettings settingsForBower = (BowerRepositorySettings) settings;\n    String bowerRegistryUrl = settingsForBower.getBowerRegistryUrl();\n}\n```\n\n##### Storage Summary Info\n\n```groovy\nBinariesSummary binariesSummary = artifactory.storage().getStorageInfo().getBinariesSummary();\nFileStorageSummary fileStorageSummary = artifactory.storage().getStorageInfo().getFileStoreSummary();\n\nfor (RepositorySummary repoSummary : artifactory.storage().getStorageInfo().getRepositoriesSummaryList()) {\n    repoSummary.getRepoKey();\n}\n```\n\n#### Search\n\n##### Available Searches\n\n```groovy\nSearches repositories(String... repositories);\n\nSearches artifactsByName(String name);\n\nSearches artifactsCreatedSince(long sinceMillis);\n\nSearches artifactsCreatedInDateRange(long fromMillis, long toMillis);\n\nSearches artifactsByGavc();\n\nSearches artifactsLatestVersion();\n\nList\u003cAqlItem\u003e artifactsByFileSpec(FileSpec fileSpec);\n```\n\n##### Searching Files in Repositories\n\n```groovy\nList\u003cRepoPath\u003e searchItems = artifactory.searches()\n        .repositories(\"RepoName\", \"RepoName2\")\n        .artifactsByName(\"prefixedWith*.txt\")\n        .doSearch();\n\nfor (RepoPath searchItem : searchItems) {\n    String repoKey = searchItem.getRepoKey();\n    String itemPath = searchItem.getItemPath();\n}\n```\n\n##### Searching Files by Properties\n\n```groovy\nList\u003cRepoPath\u003e searchItems = artifactory.searches()\n        .repositories(\"RepoName\", \"RepoName2\")\n        .itemsByProperty()\n        .property(\"released\")\n        .property(\"colors\", \"r*?\")\n        .doSearch();\n\nfor (RepoPath searchItem : searchItems) {\n    String repoKey = searchItem.getRepoKey();\n    String itemPath = searchItem.getItemPath();\n}\n```\n\n##### Searching Files by GAVC\n\n```groovy\nList\u003cRepoPath\u003e results = artifactory.searches().artifactsByGavc()\n        .groupId(\"com.example\")\n        .artifactId(\"com.example.test\")\n        .version(\"1.0.0\")\n        .classifier(\"zip\")\n        .doSearch();\n\nfor (RepoPath searchItem : searchItems) {\n    String repoKey = searchItem.getRepoKey();\n    String itemPath = searchItem.getItemPath();\n}\n```\n\n##### Searching Files by GAVC and Repository\n\n```groovy\nList\u003cRepoPath\u003e results = artifactory.searches().artifactsByGavc()\n        .groupId(\"com.example\")\n        .artifactId(\"com.example.test\")\n        .repositories(\"liba-release-local\")\n        .doSearch();\n\nfor (RepoPath searchItem : searchItems) {\n    String repoKey = searchItem.getRepoKey();\n    String itemPath = searchItem.getItemPath();\n}\n```\n\n##### Searching Files by GAVC and Virtual or Remote Repository\n\n```groovy\nList\u003cRepoPath\u003e results = artifactory.searches().artifactsByGavc()\n        .groupId(\"com.example\")\n        .artifactId(\"com.example.test\")\n        .repositories(\"maven-libs-release\")\n        .specific()\n        .doSearch();\n\nfor (RepoPath searchItem : searchItems) {\n    String repoKey = searchItem.getRepoKey();\n    String itemPath = searchItem.getItemPath();\n}\n```\n* From Artifactory version 7.37.9, the following\n\u0026specific=true(default false)\n attribute was added to support virtual and remote repositories. See [here](https://jfrog.com/help/r/jfrog-rest-apis/usage-for-remote-and-virtual-repositories).\n\n##### Searching Latest Version by GAVC and Repository\n\n```groovy\nString latestVersion = artifactory.searches().artifactsLatestVersion()\n        .groupId(\"com.example\")\n        .artifactId(\"com.example.test\")\n        .repositories(\"liba-release-local\")\n        .doRawSearch();\n```\n\n##### Searching Files Using File Specs\n\n```groovy\nFileSpec fileSpec = FileSpec.fromString(\"{\\\"files\\\": [{\\\"pattern\\\": \\\"liba-release-local/*test*\\\"}]}\");\nList\u003cAqlItem\u003e results = artifactory.searches().artifactsByFileSpec(fileSpec);\n```\n\n#### Builds\n\n##### Get All Builds\n```groovy\nAllBuilds allBuilds = artifactory.builds().getAllBuilds();\n```\n\n##### Get Build Runs\n```groovy\nBuildRuns buildRuns = artifactory.builds().getBuildRuns(\"BuildName\");\n```\n\n#### Managing Items (files and folders)\n\n##### Getting Items\n\n```groovy\nItemHandle fileItem = artifactory.repository(\"RepoName\").file(\"path/to/file.txt\");\nItemHandle folderItem = artifactory.repository(\"RepoName\").folder(\"path/to/folder\");\n```\n\n##### Copying Items\n\n```groovy\nItemHandle item =\n...\nItemHandle newItem = item.copy(\"ToRepoName\", \"path/to/item\");\n```\n\n##### Moving Items\n\n```groovy\nItemHandle item =\n...\nItemHandle newItem = item.move(\"ToRepoName\", \"path/to/item\");\n```\n\n##### Deleting Items\n\n```groovy\nString result = artifactory.repository(\"RepoName\").delete(\"path/to/item\");\n```\n\n#### Managing Repositories\n\n##### List all Repositories\n\n```groovy\nimport static org.jfrog.artifactory.client.model.impl.RepositoryTypeImpl.LOCAL;\nimport static org.jfrog.artifactory.client.model.impl.RepositoryTypeImpl.REMOTE;\nimport static org.jfrog.artifactory.client.model.impl.RepositoryTypeImpl.VIRTUAL;\nimport static org.jfrog.artifactory.client.model.impl.RepositoryTypeImpl.FEDERATED;\n\n...\nList\u003cLightweightRepository\u003e localRepoList = artifactory.repositories().list(LOCAL);\nList\u003cLightweightRepository\u003e remoteRepoList = artifactory.repositories().list(REMOTE);\nList\u003cLightweightRepository\u003e virtualRepoList = artifactory.repositories().list(VIRTUAL);\nList\u003cLightweightRepository\u003e federatedRepoList = artifactory.repositories().list(FEDERATED);\n```\n\n##### Creating Repositories\n\n```groovy\nDebianRepositorySettingsImpl settings = new DebianRepositorySettingsImpl();\nsettings.setDebianTrivialLayout(true);\n\nRepository repository = artifactory.repositories()\n        .builders()\n        .localRepositoryBuilder()\n        .key(\"NewRepoName\")\n        .description(\"new local repository\")\n        .repositorySettings(settings)\n        .build();\n\nString result = artifactory.repositories().create(2, repository);\n```\n\n\n##### Creating Federated Repositories\n\n```groovy\nDockerRepositorySettings settings = new DockerRepositorySettingsImpl();\nList\u003cFederatedMember\u003e federatedMembers = new ArrayList\u003cFederatedMember\u003e();\nFederatedMember federatedMember =  new FederatedMember(\"http://\u003cJPDURL\u003e/artifactory/\"+NewRepoName, true);\nfederatedMembers.add(federatedMember);\nRepository repository = artifactory.repositories()\n        .builders()\n        .federatedRepositoryBuilder()\n        .members(federatedMembers)\n        .key(\"NewRepoName\")\n        .description(\"new federated repository\")\n        .repositorySettings(settings)\n        .build();\n\nString result = artifactory.repositories().create(2, repository);\n```\n\n##### Repository Settings\n\nFor choosing your repository characteristic, use the right settings, each one of them possess the relevant attributes\navailable in Artifactory.\n\nExample for using generic repository with maven layout:\n\n```groovy\nRepositorySettings settings = new GenericRepositorySettingsImpl()\nsettings.setRepoLayout(\"maven-2-default\")\n```\n\n##### Updating Repositories\n\n```groovy\nRepository repository = artifactory.repository(\"RepoName\").get();\nRepositorySettings settings = repository.getRepositorySettings();\n\nif (PackageType.debian == settings.getPackageType()) {\n    DebianRepositorySettingsImpl settingsForDebian = (DebianRepositorySettingsImpl) settings;\n    settingsForDebian.setDebianTrivialLayout(false);\n}\n\nRepository updatedRepository = artifactory.repositories()\n        .builders()\n        .builderFrom(repository)\n        .description(\"new_description\")\n        .build();\n\nString result = artifactory.repositories().update(updatedRepository);\n```\n\n##### Deleting Repositories\n\n```groovy\nString result = artifactory.repository(\"RepoName\").delete();\n```\n\n##### Deleting all Repository Replications\n\n```groovy\n// Method supported for local and remote repositories\nartifactory.repository(\"RepoName\").replications.delete()\n```\n\n##### Creating or replacing a replication on a local repository\n\n```groovy\nLocalReplication replication = new LocalReplicationBuilderImpl()\n        .url(\"http://hostname1:port/artifactory/RepoName\")\n        .socketTimeoutMillis(30000)\n        .username(\"john.doe\")\n        .password(\"secret\")\n        .enableEventReplication(false)\n        .enabled(false)\n        .cronExp(\"0 0 0/2 * * ?\")\n        .syncDeletes(true)\n        .syncProperties(true)\n        .syncStatistics(true)\n        .pathPrefix(\"\")\n        .repoKey(\"RepoName\")\n        .build();\n\nartifactory.repository(\"RepoName\").getReplications().createOrReplace(replication);\n```\n\n##### Creating or replacing a replication on a remote repository\n\n```groovy\nRemoteReplication replication = new RemoteReplicationBuilderImpl()\n        .enabled(false)\n        .cronExp(\"0 0 0/2 * * ?\")\n        .syncDeletes(true)\n        .syncProperties(true)\n        .repoKey(\"RepoName\")\n        .build();\n\nartifactory.repository(\"RepoName\").getReplications().createOrReplace(replication)\n```\n\n##### Managing Xray properties\n\n```groovy\nRepository repository = artifactory.repository(\"RepoName\").get();\n\nXraySettings xraySettings = repository.getXraySettings();\nxraySettings.setXrayIndex(true)\n\nRepository updatedRepository = artifactory.repositories()\n        .builders()\n        .builderFrom(repository)\n        .description(\"new_description\")\n        .build();\n\nString result = artifactory.repositories().update(updatedRepository);\n```\n\n##### Custom Package Type and Properties\n\n```groovy\nCustomPackageTypeImpl customPackageType = new CustomPackageTypeImpl(\"name\");\nCustomRepositorySettingsImpl settings = new CustomRepositorySettingsImpl(customPackageType);\n\nMap\u003cString, Object\u003e customProperties = new HashMap\u003c\u003e();\ncustomProperties.put(\"key\", \"value\");\n\nRepository repository = artifactory.repositories()\n        .builders()\n        .localRepositoryBuilder()\n        .key(\"NewRepoName\")\n        .description(\"new local repository\")\n        .repositorySettings(settings)\n        .customProperties(customProperties)\n        .build();\n\nString result = artifactory.repositories().create(2, repository);\n```\n\n##### Smart Remote Repositories\n\nA [smart remote repository](https://www.jfrog.com/confluence/display/RTF/Smart+Remote+Repositories) is a remote\nrepository that proxies a repository from another instance of Artifactory. Smart remote repositories are configured with\nfour additional properties.\n\n```groovy\nRemoteRepository remoteRepository = (RemoteRepository) artifactory.repository(\"SmartRemoteRepoName\").get();\nContentSync contentSync = remoteRepository.getContentSync();\ncontentSync.setEnabled(true);\n// Report Statistics\ncontentSync.getStatistics().setEnabled(true);\n// Sync Properties\ncontentSync.getProperties().setEnabled(true);\n// Source Absence Detection\ncontentSync.getSource().setOriginAbsenceDetection(true);\n\nRepository updatedRepository = artifactory.repositories()\n        .builders()\n        .builderFrom(remoteRepository)\n        .listRemoteFolderItems(true)    // List Remote Folder Items\n        .build();\n\nString result = artifactory.repositories().update(updatedRepository);\n```\n\n#### Managing Users\n\n##### Geting User Information\n\n```groovy\nUser user = artifactory.security().user(\"userName\");\nString name = user.getName();\nString email = user.getEmail();\nCollection\u003cString\u003e groups = user.getGroups();\nDate loggedIn = user.getLastLoggedIn();\nboolean profileUpdatable = user.isProfileUpdatable();\nboolean isAdmin = user.isAdmin();\nboolean internalPass = user.isInternalPasswordDisabled();\nString realm = user.getRealm();\n```\n\n##### List all User Names\n\n```groovy\nCollection\u003cString\u003e userNames = artifactory.security().userNames();\nfor (String userName : userNames) {\n    User user = artifactory.security().user(userName);\n}\n```\n\n##### Creating or Updating Users\n\n```groovy\nUserBuilder userBuilder = artifactory.security().builders().userBuilder();\nUser user = userBuilder.name(\"userName\")\n        .email(\"user@mail.com\")\n        .admin(false)\n        .profileUpdatable(true)\n        .password(\"password\")\n        .build();\n\nartifactory.security().createOrUpdate(user);\n```\n\n##### Deleting Users\n\n```groovy\nString result = artifactory.security().deleteUser(\"userName\");\n```\n\n#### Managing User Groups\n\n##### Get User Group Information\n\n```groovy\nGroup group = artifactory.security().group(\"groupName\");\nString description = group.getDescription();\nboolean isAutoJoin = group.isAutoJoin();\nboolean isAdminPrivileges = group.isAdminPrivileges();\n```\n\n##### List all User Groups\n\n```groovy\nList\u003cString\u003e groupNames = artifactory.security().groupNames();\nfor (String groupName : groupNames) {\n    Group group = artifactory.security().group(groupName);\n}\n```\n\n##### Creating or Updating User Groups\n\n```groovy\nGroup group = artifactory.security().builders().groupBuilder()\n        .name(\"groupName\")\n        .autoJoin(true)\n        .adminPrivileges(true)\n        .description(\"new group\")\n        .build();\n\nartifactory.security().createOrUpdateGroup(group);\n```\n\n##### Creating or Updating User External Groups\n\nWhen using [LDAP integration](https://www.jfrog.com/confluence/display/RTF/Managing+Security+with+LDAP)\nor [realm User plugin](https://www.jfrog.com/confluence/display/RTF/User+Plugins#UserPlugins-Realms), it could be\ninteresting to preload groups (and permissions) before any user login :\n\n```groovy\nString realmAttributes = \"ldapGroupName=groupName;groupsStrategy=STATIC;groupDn=cn=GROUPNAME,ou=foo,o=bar\";\nGroup group = artifactory.security().builders().groupBuilder()\n        .name(\"groupName\")\n        .description(\"GROUPNAME\")\n        .realm(\"ldap\")\n        .realmAttributes(realmAttributes)\n        .build();\nartifactory.security().createOrUpdateGroup(group);\n```\n\n**NB**: The *realmAttributes* depends of realm implementation ; so firstly,\nuse [LDAP Groups Synchronization](https://www.jfrog.com/confluence/display/RTF/LDAP+Groups#LDAPGroups-SynchronizingLDAPGroupswithArtifactory)\nto import some groups manually in Artifactory, and analyse a JSON GET on one of this/these group(s) to understand the\ncontent of *realmAttributes* parameter.\n\n##### Deleting User Groups\n\n```groovy\nartifactory.security().deleteGroup(\"groupName\");\n```\n\n#### Permissions\n\n##### Getting Item Permissions\n\n```groovy\nSet\u003cItemPermission\u003e itemPermissions = artifactory.repository(\"RepoName\")\n        .file(\"path/to/file.txt\")\n        .effectivePermissions();\n\nfor (ItemPermission itemPermission : itemPermissions) {\n    RepoPath repoPath = itemPermissions.getRepoPath();\n    List\u003cPrivilege\u003e privileges = getPrivileges();\n    Subject subject = getSubject();\n    boolean isAllowedTo = isAllowedTo(ADMIN, DELETE, DEPLOY, ANNOTATE, READ);\n}\n```\n\n##### Getting Permission Target information\n\n```groovy\nPermissionTarget permissionTarget = artifactory.security().permissionTarget(\"permissionName\");\nString name = permissionTarget.getName()\n);\nString exclude = permissionTarget.getExcludesPattern();\nString include = permissionTarget.getIncludesPattern();\nList\u003cString\u003e repos = permissionTarget.getRepositories();\nList\u003cItemPermission\u003e perm = permissionTarget.getItemPermissions();\n```\n\n##### Listing all Permission Targets\n\n```groovy\nList\u003cString\u003e permissionTargetNames = artifactory.security().permissionTargets();\nfor (String permissionTargetName : permissionTargetNames) {\n    PermissionTarget permissionTarget = artifactory.security().permissionTarget(permissionTargetName);\n}\n```\n\n##### Creating a Permission Target\n\n```groovy\nPrincipal userAdmin = artifactory.security().builders().principalBuilder()\n        .name(\"admin\")\n        .privileges(Privilege.ADMIN)\n        .build();\n\nPrincipal groupTest = artifactory.security().builders().principalBuilder()\n        .name(\"myTest\")\n        .privileges(Privilege.DEPLOY, Privilege.READ)\n        .build();\n\nPrincipals principals = artifactory.security().builders().principalsBuilder()\n        .users(userAdmin)\n        .groups(groupTest)\n        .build();\n\nPermissionTarget permissionTarget = artifactory.security().builders().permissionTargetBuilder()\n        .name(\"myPermission\")\n        .principals(principals)\n        .repositories(\"some-repository\")\n        .includesPattern(\"com/company/**,org/public/**\")\n        .build();\n\nartifactory.security().createOrReplacePermissionTarget(permissionTarget);\n```\n\n#### System\n\n##### Artifactory version\n\n```groovy\nVersion version = artifactory.system().version();\nString version = version.getVersion();\nString revision = version.getRevision();\nString license = version.getLicense();\nList\u003cString\u003e addons = version.getAddons();\n```\n\n##### Getting System Configuration XML\n\n```groovy\nString xml = artifactory.system().configuration();\n```\n\n##### Setting System Configuration XML\n\n```groovy\nartifactory.system().configuration(xml);\n```\n\n##### Getting System Configuration YAML\n\n```groovy\nString yaml = artifactory.system().yamlConfiguration();\n```\n\n##### Setting System Configuration YAML\n\n```groovy\nartifactory.system().yamlConfiguration(yaml);\n```\n\n#### Rest API\n\nExecuting an Artifactory REST API\n\n```groovy\nArtifactoryRequest repositoryRequest = new ArtifactoryRequestImpl().apiUrl(\"api/repositories\")\n        .method(ArtifactoryRequest.Method.GET)\n        .responseType(ArtifactoryRequest.ContentType.JSON);\nArtifactoryResponse response = artifactory.restCall(repositoryRequest);\n\n// Get the response headers\norg.apache.http.Header[] headers = response.getAllHeaders();\n\n// Get the response status information\norg.apache.http.StatusLine statusLine = response.getStatusLine();\n\n// A convenience method for verifying success\nassert response.isSuccessResponse();\n\n// Get the response raw body\nString rawBody = response.getRawBody();\n\n// If the the response raw body has a JSON format, populate an object with the body content, \n// by providing a object's class. \nList\u003cMap\u003cString, String\u003e\u003e parsedBody = response.parseBody(List.class);\n```\n\nExecuting an Artifactory streaming REST API\n\n```groovy\nArtifactoryRequest repositoryRequest = new ArtifactoryRequestImpl().apiUrl(\"api/repositories\")\n        .method(ArtifactoryRequest.Method.GET)\n        .responseType(ArtifactoryRequest.ContentType.JSON);\nArtifactoryStreamingResponse response = artifactory.streamingRestCall(repositoryRequest);\n\n// Get the response headers\norg.apache.http.Header[] headers = response.getAllHeaders();\n\n// Get the response status information\norg.apache.http.StatusLine statusLine = response.getStatusLine();\n\n// A convenience method for verifying success\nassert response.isSuccessResponse();\n\n// Get the response raw body using input stream\nString rawBody = IOUtils.toString(response.getInputStream(), StandardCharsets.UTF_8);\n```\n\n## Building and Testing the Sources\n\nThe code is built using Gradle and includes integration tests.\n\nSince the tests may use features which have been recently added to Artifactory, such as new package types, it is best to\nrun the tests against the latest release of Artifactory. Some tests may therefore fail otherwise. Those tests can be\nmanually commented out in that case.\n\nIf you'd like to build the code without tests, run:\n\n```shell\ngradle clean build -x test\n```\n\nPlease follow these steps to build and test the code:\n\n* Startup an Artifactory-Pro instance.\n* Set the *CLIENTTESTS_ARTIFACTORY_URL*, *CLIENTTESTS_ARTIFACTORY_USERNAME* and *CLIENTTESTS_ARTIFACTORY_PASSWORD* \n  environment variables with your Artifactory URL, username and password.\n* Run:\n\n```shell\ngradle clean test\n```\n\n## Example Projects\n\nWe created [sample projects](https://github.com/jfrog/project-examples/tree/master/artifactory-client-java-examples)\ndemonstrating how to use the Artifactory Java Client.\n\n## Contributing Code\n\nWe welcome community contribution through pull requests.\n\n### Guidelines\n\n* If the existing tests do not already cover your changes, please add tests..\n* Pull requests should be created on the *dev* branch.\n\n## License\n\nThis client is available under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).\n\n## Release Notes\n\nThe release notes are available [here](RELEASE.md#release-notes).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfrog%2Fartifactory-client-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjfrog%2Fartifactory-client-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfrog%2Fartifactory-client-java/lists"}