Skip to content

Commit 1e8b058

Browse files
committed
Re-arrange the logic in the spring-artifactory-init
1 parent 0f35645 commit 1e8b058

File tree

1 file changed

+43
-44
lines changed

1 file changed

+43
-44
lines changed

utils/spring-artifactory-init.gradle

+43-44
Original file line numberDiff line numberDiff line change
@@ -12,59 +12,58 @@ def gpgPassphrase = System.getenv('GPG_PASSPHRASE')
1212
def gpgPrivateKey = System.getenv('GPG_PRIVATE_KEY')
1313

1414
allprojects {
15-
1615
apply plugin: 'signing'
1716

18-
tasks.register('artifactoryPublish', org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask) {
19-
enabled(false)
20-
setCiServerBuild()
21-
}
22-
2317
apply plugin: org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin
2418

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-
def zipArtifactProps =
35-
['zip.name' : project.name,
36-
'zip.displayname': project.description,
37-
'zip.deployed' : 'false']
38-
properties {
39-
mavenJava zipArtifactProps, '*:*:*:*@zip'
40-
mavenJava 'zip.type': 'docs', '*:*:*:docs@zip'
41-
mavenJava 'zip.type': 'dist', '*:*:*:dist@zip'
42-
}
43-
}
44-
publishForkCount = 10
45-
}
46-
47-
buildInfo {
48-
setProject(System.getenv('ARTIFACTORY_BUILD_PROJECT'))
49-
setBuildName(System.getenv('ARTIFACTORY_BUILD_NAME'))
50-
setBuildNumber(System.getenv('ARTIFACTORY_BUILD_NUMBER'))
51-
setBuildUrl(System.getenv('ARTIFACTORY_BUILD_URL'))
52-
setAgentName(System.getenv('ARTIFACTORY_USER_AGENT_NAME'))
53-
setAgentVersion(System.getenv('ARTIFACTORY_USER_AGENT_VERSION'))
54-
setVcsRevision(System.getenv('ARTIFACTORY_VCS_REVISION'))
55-
setVcsUrl(System.getenv('ARTIFACTORY_VCS_URL'))
56-
setArtifactoryPluginVersion('4.33.12')
57-
}
58-
59-
clientConfig.connectionRetries = 4
60-
clientConfig.insecureTls = false
19+
tasks.named('artifactoryPublish') {
20+
enabled = false
6121
}
6222

6323
afterEvaluate {
6424
pluginManager.withPlugin('maven-publish') {
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+
def zipArtifactProps =
35+
['zip.name' : project.name,
36+
'zip.displayname': project.description,
37+
'zip.deployed' : 'false']
38+
properties {
39+
mavenJava zipArtifactProps, '*:*:*:*@zip'
40+
mavenJava 'zip.type': 'docs', '*:*:*:docs@zip'
41+
mavenJava 'zip.type': 'dist', '*:*:*:dist@zip'
42+
}
43+
}
44+
publishForkCount = 10
45+
}
46+
47+
buildInfo {
48+
setProject(System.getenv('ARTIFACTORY_BUILD_PROJECT'))
49+
setBuildName(System.getenv('ARTIFACTORY_BUILD_NAME'))
50+
setBuildNumber(System.getenv('ARTIFACTORY_BUILD_NUMBER'))
51+
setBuildUrl(System.getenv('ARTIFACTORY_BUILD_URL'))
52+
setAgentName(System.getenv('ARTIFACTORY_USER_AGENT_NAME'))
53+
setAgentVersion(System.getenv('ARTIFACTORY_USER_AGENT_VERSION'))
54+
setVcsRevision(System.getenv('ARTIFACTORY_VCS_REVISION'))
55+
setVcsUrl(System.getenv('ARTIFACTORY_VCS_URL'))
56+
setArtifactoryPluginVersion('4.33.12')
57+
}
58+
59+
clientConfig.connectionRetries = 4
60+
}
61+
6562
tasks.named('artifactoryPublish') {
66-
enabled(true)
67-
publications 'mavenJava'
63+
enabled = true
64+
setCiServerBuild()
65+
publications publishing.publications.mavenJava
66+
publishIvy = false
6867
}
6968

7069
if (!ossrhUrl && gpgPassphrase && gpgPrivateKey) {

0 commit comments

Comments
 (0)