Skip to content

Commit a5e6e21

Browse files
committed
Apply artifactory only if maven-publish plugin
1 parent 6187263 commit a5e6e21

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

utils/spring-artifactory-init.gradle

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,51 +22,51 @@ allprojects {
2222

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

25-
artifactory {
26-
publish {
27-
contextUrl = System.getenv('ARTIFACTORY_URL')
28-
repository {
29-
repoKey = System.getenv('ARTIFACTORY_REPOSITORY')
30-
username = System.getenv('ARTIFACTORY_USERNAME')
31-
password = System.getenv('ARTIFACTORY_PASSWORD')
32-
}
33-
defaults {
34-
publications 'mavenJava'
35-
def zipArtifactProps =
36-
['zip.name' : project.name,
37-
'zip.displayname': project.description,
38-
'zip.deployed' : 'false']
39-
properties {
40-
mavenJava zipArtifactProps, '*:*:*:*@zip'
41-
mavenJava 'zip.type': 'docs', '*:*:*:docs@zip'
42-
mavenJava 'zip.type': 'dist', '*:*:*:dist@zip'
25+
afterEvaluate {
26+
pluginManager.withPlugin('maven-publish') {
27+
artifactory {
28+
publish {
29+
contextUrl = System.getenv('ARTIFACTORY_URL')
30+
repository {
31+
repoKey = System.getenv('ARTIFACTORY_REPOSITORY')
32+
username = System.getenv('ARTIFACTORY_USERNAME')
33+
password = System.getenv('ARTIFACTORY_PASSWORD')
34+
}
35+
defaults {
36+
publications 'mavenJava'
37+
def zipArtifactProps =
38+
['zip.name' : project.name,
39+
'zip.displayname': project.description,
40+
'zip.deployed' : 'false']
41+
properties {
42+
mavenJava zipArtifactProps, '*:*:*:*@zip'
43+
mavenJava 'zip.type': 'docs', '*:*:*:docs@zip'
44+
mavenJava 'zip.type': 'dist', '*:*:*:dist@zip'
45+
}
46+
}
47+
publishForkCount = 10
4348
}
44-
}
45-
publishForkCount = 10
46-
}
47-
48-
buildInfo {
49-
setProject(System.getenv('ARTIFACTORY_BUILD_PROJECT'))
50-
setBuildName(System.getenv('ARTIFACTORY_BUILD_NAME'))
51-
setBuildNumber(System.getenv('ARTIFACTORY_BUILD_NUMBER'))
52-
setBuildUrl(System.getenv('ARTIFACTORY_BUILD_URL'))
53-
setAgentName(System.getenv('ARTIFACTORY_USER_AGENT_NAME'))
54-
setAgentVersion(System.getenv('ARTIFACTORY_USER_AGENT_VERSION'))
55-
setVcsRevision(System.getenv('ARTIFACTORY_VCS_REVISION'))
56-
setVcsUrl(System.getenv('ARTIFACTORY_VCS_URL'))
57-
setArtifactoryPluginVersion('4.33.12')
58-
}
5949

60-
clientConfig.connectionRetries = 4
61-
clientConfig.insecureTls = false
62-
}
50+
buildInfo {
51+
setProject(System.getenv('ARTIFACTORY_BUILD_PROJECT'))
52+
setBuildName(System.getenv('ARTIFACTORY_BUILD_NAME'))
53+
setBuildNumber(System.getenv('ARTIFACTORY_BUILD_NUMBER'))
54+
setBuildUrl(System.getenv('ARTIFACTORY_BUILD_URL'))
55+
setAgentName(System.getenv('ARTIFACTORY_USER_AGENT_NAME'))
56+
setAgentVersion(System.getenv('ARTIFACTORY_USER_AGENT_VERSION'))
57+
setVcsRevision(System.getenv('ARTIFACTORY_VCS_REVISION'))
58+
setVcsUrl(System.getenv('ARTIFACTORY_VCS_URL'))
59+
setArtifactoryPluginVersion('4.33.12')
60+
}
6361

62+
clientConfig.connectionRetries = 4
63+
clientConfig.insecureTls = false
64+
}
6465

65-
afterEvaluate {
66-
pluginManager.withPlugin('maven-publish') {
6766
tasks.named('artifactoryPublish') {
6867
enabled(true)
6968
}
69+
7070
if (!ossrhUrl && gpgPassphrase && gpgPrivateKey) {
7171
signing {
7272
useInMemoryPgpKeys(gpgPrivateKey, gpgPassphrase)

0 commit comments

Comments
 (0)