@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2023 the original author or authors .
* Copyright 2002 - 2024 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -36,8 +36,6 @@ public class SpringArtifactoryPlugin implements Plugin<Project> {
@@ -36,8 +36,6 @@ public class SpringArtifactoryPlugin implements Plugin<Project> {
// Apply artifactory repository configuration
boolean isSnapshot = ProjectUtils . isSnapshot ( project ) ;
boolean isMilestone = ProjectUtils . isMilestone ( project ) ;
String artifactoryUsername = ( String ) project . findProperty ( "artifactoryUsername" ) ;
String artifactoryPassword = ( String ) project . findProperty ( "artifactoryPassword" ) ;
ArtifactoryPluginConvention artifactoryExtension = project . getExtensions ( ) . getByType ( ArtifactoryPluginConvention . class ) ;
artifactoryExtension . publish ( ( publish ) - > {
@ -46,12 +44,14 @@ public class SpringArtifactoryPlugin implements Plugin<Project> {
@@ -46,12 +44,14 @@ public class SpringArtifactoryPlugin implements Plugin<Project> {
String repoKey = isSnapshot ? "libs-snapshot-local" : isMilestone ? "libs-milestone-local" : "libs-release-local" ;
repository . setRepoKey ( repoKey ) ;
if ( project . hasProperty ( "artifactoryUsername" ) ) {
repository . setUsername ( artifactoryUsername ) ;
repository . setPassword ( artifactoryPassword ) ;
repository . setUsername ( ( String ) project . findProperty ( " artifactoryUsername" ) ) ;
repository . setPassword ( ( String ) project . findProperty ( " artifactoryPassword" ) ) ;
}
} ) ;
// Would fail if maven publish is not applied, i.e. in root project (SpringRootProjectPlugin)
project . getPlugins ( ) . withType ( MavenPublishPlugin . class , mavenPublish - > publish . defaults ( ( defaults ) - > defaults . publications ( "mavenJava" ) ) ) ;
project . getPlugins ( ) . withType ( MavenPublishPlugin . class , mavenPublish - > {
publish . defaults ( ( defaults ) - > defaults . publications ( "mavenJava" ) ) ;
} ) ;
} ) ;
}
}