It's not, its this: ``` /** * Contains the inform...
# gradle
j
It's not, its this:
Copy code
/**
 * Contains the information needed to login to a Plexxi user's Jfrog Artifactory account.
 */
data class ArtifactoryLogin(
    val artifactoryUsername: String,
    val artifactoryPassword: String
) {

    /**
     * Configures a [org.gradle.api.credentials.PasswordCredentials] with the developers
     * Artifactory credentials.
     */
    fun configurePasswordCredentials(passwordCredentials: org.gradle.api.credentials.PasswordCredentials) {
        passwordCredentials.username = artifactoryUsername
        passwordCredentials.password = artifactoryPassword
    }
}

/**
 * Creates the {@link ArtifactoryLogin} object if the build has the correct properties supplied.
 * If they are not supplied then this method returns `null`.
 */
fun createArtifactoryLogin(): ArtifactoryLogin? {
    val artifactoryUsernameProp = "artifactoryUsername"
    val artifactoryPasswordProp = "artifactoryPassword"
    // Store the `missingProp` value so that all problems can be logged before returning `null`.
    var missingProp = false
    if (!gradle.rootProject.hasProperty(artifactoryUsernameProp)) {
        logger.warn("`$artifactoryUsernameProp` must be provided as a property to configure the maven repositories")
        missingProp = true
    }
    if (!gradle.rootProject.hasProperty(artifactoryPasswordProp)) {
        logger.warn("`$artifactoryPasswordProp` must be provided as a property to configure the maven repositories")
        missingProp = true
    }
    if (missingProp) {
        logger.warn("The tasks associated with publishing to the Plexxi JFrog Artifactory will not be added")
        logger.warn("The build will not use Plexxi JFrog Artifactory to resolve dependencies.")
        return null
    }
    return ArtifactoryLogin(
        artifactoryUsername = gradle.rootProject.property(artifactoryUsernameProp) as String,
        artifactoryPassword = gradle.rootProject.property(artifactoryPasswordProp) as String
    )
}

val artifactoryLogin = createArtifactoryLogin()