# Jenkins and JFrog Artifactory - artifacts are not deleted after "maxBuilds"

**URL:** <https://community.jenkins.io/t/jenkins-and-jfrog-artifactory-artifacts-are-not-deleted-after-maxbuilds/1441>\
**Category:** Ask a question\
**Created:** [February 7, 2022, 9:51am UTC](https://community.jenkins.io/t/jenkins-and-jfrog-artifactory-artifacts-are-not-deleted-after-maxbuilds/1441 "2022-02-07T09:51:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cane](https://avatars.discourse-cdn.com/v4/letter/c/a183cd/32.png) [@cane](https://community.jenkins.io/u/cane)\
**Post date:** [February 7, 2022, 9:51am UTC](https://community.jenkins.io/t/jenkins-and-jfrog-artifactory-artifacts-are-not-deleted-after-maxbuilds/1441/1 "2022-02-07T09:51:01Z")

</div>

I am successfully uploading my artifacts using the JFrong plugin. I think I have set up everything for automatic deletion once the number of builds (artifacts) is more than 5. However my artifacts are not deleted (I have them more than `maxBuilds` property) although the user which I am using for upload has permission to delete artifact (I’ve tried and it works manually). Did I configure everything properly? Thanks

```auto
   stage ('Artifactory stage') {
            steps {
                rtServer (
                    id: 'Artifactory',
                    url: 'https://artifactory.domain/artifactory',
                    credentialsId: 'test',
                    timeout: 300
                )
            }
        }

        stage ('Build info stage ') {
            steps {
                rtBuildInfo (
                    maxBuilds: 5,
                    deleteBuildArtifacts: true
                )
            }
        }

        stage ('Upload stage') {
            steps {
                rtUpload (
                    serverId: 'Artifactory',
                    spec: '''{
                          "files": [
                            {
                              "pattern": "arena-*.zip",
                              "target": "project/packages/"
                            }
                         ]
                    }''',
                )
            }
        }

        stage ('Publish build info') {
            steps {
                rtPublishBuildInfo (
                    serverId: 'Artifactory'
                )
            }
        }

```

---

<div class="post-metadata">

**Author:** ![PyryV](https://avatars.discourse-cdn.com/v4/letter/p/ea666f/32.png) [@PyryV](https://community.jenkins.io/u/PyryV)\
**Post date:** [May 13, 2025, 8:11am UTC](https://community.jenkins.io/t/jenkins-and-jfrog-artifactory-artifacts-are-not-deleted-after-maxbuilds/1441/2 "2025-05-13T08:11:33Z")

</div>

Starting with **Artifactory version 7.68.6** , there has been a change in the behavior of the build deletion process. Specifically, build artifacts may no longer be deleted automatically when the `deleteBuildArtifacts` parameter is set to `true`. This is due to an updated requirement where the deletion process now also depends on the `build.timestamp` parameter, in addition to `build.name` and `build.number`. [https://jfrog.com/help/r/jfrog-rest-apis/control-build-retention?tocId=fQqrl6FPSrISc9Pas8oKCw](https://jfrog.com/help/r/jfrog-rest-apis/control-build-retention?tocId=fQqrl6FPSrISc9Pas8oKCw)

### Workaround

To restore the legacy behavior—where only the build name and number are used to locate and delete associated artifacts—you can apply the following configuration change:

1. Open the file located at:

```auto

$JFROG_HOME/artifactory/var/etc/artifactory/artifactory.system.properties

```

1. Add the following property:

```auto

artifactory.build.forced.delete.artifacts=false

```

1. Restart Artifactory for the change to take effect.

This configuration forces Artifactory to bypass the `build.timestamp` requirement and revert to the previous artifact deletion logic.
