Skip to content

Commit

Permalink
Apply artifactory only if maven-publish plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
artembilan committed Feb 9, 2024
1 parent 6187263 commit a5e6e21
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions utils/spring-artifactory-init.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,51 +22,51 @@ allprojects {

apply plugin: org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin

artifactory {
publish {
contextUrl = System.getenv('ARTIFACTORY_URL')
repository {
repoKey = System.getenv('ARTIFACTORY_REPOSITORY')
username = System.getenv('ARTIFACTORY_USERNAME')
password = System.getenv('ARTIFACTORY_PASSWORD')
}
defaults {
publications 'mavenJava'
def zipArtifactProps =
['zip.name' : project.name,
'zip.displayname': project.description,
'zip.deployed' : 'false']
properties {
mavenJava zipArtifactProps, '*:*:*:*@zip'
mavenJava 'zip.type': 'docs', '*:*:*:docs@zip'
mavenJava 'zip.type': 'dist', '*:*:*:dist@zip'
afterEvaluate {
pluginManager.withPlugin('maven-publish') {
artifactory {
publish {
contextUrl = System.getenv('ARTIFACTORY_URL')
repository {
repoKey = System.getenv('ARTIFACTORY_REPOSITORY')
username = System.getenv('ARTIFACTORY_USERNAME')
password = System.getenv('ARTIFACTORY_PASSWORD')
}
defaults {
publications 'mavenJava'
def zipArtifactProps =
['zip.name' : project.name,
'zip.displayname': project.description,
'zip.deployed' : 'false']
properties {
mavenJava zipArtifactProps, '*:*:*:*@zip'
mavenJava 'zip.type': 'docs', '*:*:*:docs@zip'
mavenJava 'zip.type': 'dist', '*:*:*:dist@zip'
}
}
publishForkCount = 10
}
}
publishForkCount = 10
}

buildInfo {
setProject(System.getenv('ARTIFACTORY_BUILD_PROJECT'))
setBuildName(System.getenv('ARTIFACTORY_BUILD_NAME'))
setBuildNumber(System.getenv('ARTIFACTORY_BUILD_NUMBER'))
setBuildUrl(System.getenv('ARTIFACTORY_BUILD_URL'))
setAgentName(System.getenv('ARTIFACTORY_USER_AGENT_NAME'))
setAgentVersion(System.getenv('ARTIFACTORY_USER_AGENT_VERSION'))
setVcsRevision(System.getenv('ARTIFACTORY_VCS_REVISION'))
setVcsUrl(System.getenv('ARTIFACTORY_VCS_URL'))
setArtifactoryPluginVersion('4.33.12')
}

clientConfig.connectionRetries = 4
clientConfig.insecureTls = false
}
buildInfo {
setProject(System.getenv('ARTIFACTORY_BUILD_PROJECT'))
setBuildName(System.getenv('ARTIFACTORY_BUILD_NAME'))
setBuildNumber(System.getenv('ARTIFACTORY_BUILD_NUMBER'))
setBuildUrl(System.getenv('ARTIFACTORY_BUILD_URL'))
setAgentName(System.getenv('ARTIFACTORY_USER_AGENT_NAME'))
setAgentVersion(System.getenv('ARTIFACTORY_USER_AGENT_VERSION'))
setVcsRevision(System.getenv('ARTIFACTORY_VCS_REVISION'))
setVcsUrl(System.getenv('ARTIFACTORY_VCS_URL'))
setArtifactoryPluginVersion('4.33.12')
}

clientConfig.connectionRetries = 4
clientConfig.insecureTls = false
}

afterEvaluate {
pluginManager.withPlugin('maven-publish') {
tasks.named('artifactoryPublish') {
enabled(true)
}

if (!ossrhUrl && gpgPassphrase && gpgPrivateKey) {
signing {
useInMemoryPgpKeys(gpgPrivateKey, gpgPassphrase)
Expand Down

0 comments on commit a5e6e21

Please sign in to comment.