Skip to content

Commit f3c9565

Browse files
committed
Add Javadoc comment about not invoking (externally-defined) Methods inside Groovy/Gradle DSL (Closures).
Additionally: * Suppress compiler warnings. * Guard against possibly null Projecct objects passed to isAuthRequired(:Project) method.
1 parent 94fe7bd commit f3c9565

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

buildSrc/src/main/groovy/io/spring/gradle/convention/ArtifactoryPlugin.groovy

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class ArtifactoryPlugin implements Plugin<Project> {
3434

3535
project.plugins.apply('com.jfrog.artifactory')
3636

37+
// (Externally-defined) Methods cannot be invoked inside the Groovy/Gradle DSL.
3738
def artifactoryRepoKey = resolveRepositoryKey(project)
3839
def authRequired = isAuthRequired(project)
3940

@@ -54,10 +55,12 @@ class ArtifactoryPlugin implements Plugin<Project> {
5455
}
5556
}
5657

58+
@SuppressWarnings("all")
5759
private boolean isAuthRequired(Project project) {
58-
project.hasProperty('artifactoryUsername')
60+
project?.hasProperty('artifactoryUsername')
5961
}
6062

63+
@SuppressWarnings("all")
6164
private String resolveRepositoryKey(Project project) {
6265

6366
boolean isSnapshot = Utils.isSnapshot(project);

0 commit comments

Comments
 (0)