buildscript {
    repositories {
        maven {
        credentials  {
           username "${mavenUser}"
           password "${mavenPassword}"
        }
		url "https://devstore.******.com/artifactory/jcenter"
    }
	maven {
        credentials  {
           username "${mavenUser}"
           password "${mavenPassword}"
        }
        url "https://devstore.******.com/artifactory/nlveg-mvn-release-local-01"
    }
    dependencies {
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.11.0"
        classpath "com.******.cm:scmplugin:4.0.0"
        classpath "de.undercouch:gradle-download-task:3.4.3" // Download task
    }
}
}

allprojects {
    apply plugin: "java"
    apply from: "$rootDir/version.gradle"
    apply from: "$rootDir/dependencies.gradle"
    apply plugin: "scmplugin" //needed for plugin

    group = 'com.******.ssswpp'
    version = artifactversion

    scm {
        repo.testUrl = "https://devstore.test.******.com/artifactory"
        repo.acceptanceUrl = "https://devstore.acc.******.com/artifactory"
        repo.productionUrl = "https://devstore.******.com/artifactory"
        repo.snapshot = "nlveg-mvn-snapshot-local-01"
        repo.stage = "nlveg-mvn-stage-local-01"
        repo.release = "nlveg-mvn-release-local-01"
    }

    repositories {
        maven {
        credentials  {
           username "${mavenUser}"
           password "${mavenPassword}"
        }
        url "https://devstore.******.com/artifactory/nlveg-mvn-release-local-01"
        }
        maven {
            credentials  {
                username "${mavenUser}"
                password "${mavenPassword}"
        }
        url ArtifactoryResolveRepoUrl()
        }
    }
}

configurations.all {
    // check for updates every build
    canBeResolved = true
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
    resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
}

artifactory {
    contextUrl = ArtifactoryContextUrl()
    publish {
        repository {
            repoKey = ArtifactoryPublishRepoKey.call()
            username = "${artifactory_user}"
            password = "${artifactory_pwd}"
            maven = true
            defaults {
                publishBuildInfo = true
                publishArtifacts = true
                publishPom = true
                publishIvy = true
                publications('mavenJava')
                properties = artifactProperties
            }

        }
    }
    resolve {
        repository {
            repoKey = ArtifactoryResolveRepoKey.call()
            username = "${artifactory_user}"
            password = "${artifactory_pwd}"
            maven = true
        }
    }
    clientConfig.timeout = 600 //Artifactory connection timeout (in seconds). The default timeout is 300 seconds.
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            groupId group
            version version
            artifactId project.name
            from components.java
            PomRegistration(pom)

            artifacts = [createPackage]
        }
    }
}
tasks.withType(GenerateModuleMetadata) {
    enabled = false
}
