if (!project.hasProperty("reactorVersion")) {
	ext.reactorVersion = "2020.0.+"
}

if (!project.hasProperty("springVersion")) {
	ext.springVersion = "5.3.+"
}

if (!project.hasProperty("springDataVersion")) {
	ext.springDataVersion = "Neumann-SR+"
}
if (!project.hasProperty("kotlinVersion")) {
	ext.kotlinVersion = "1.+"
}
if (!project.hasProperty("rsocketVersion")) {
	ext.rsocketVersion = "1.1.0"
}
if (!project.hasProperty("locksDisabled")) {
	dependencyLocking {
		lockAllConfigurations()
	}
}
ext.openSamlVersion = "3.+"

dependencies {
	management platform("org.springframework:spring-framework-bom:$springVersion")
	management platform("io.projectreactor:reactor-bom:$reactorVersion")
	management platform("org.springframework.data:spring-data-releasetrain:$springDataVersion")
	management platform("org.jetbrains.kotlin:kotlin-bom:$kotlinVersion")
	constraints {
		management "ch.qos.logback:logback-classic:1.+"
		management "com.fasterxml.jackson.core:jackson-databind:2.+"
		management 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.+'
		management "com.google.appengine:appengine-api-1.0-sdk:$gaeVersion"
		management "com.google.appengine:appengine-api-labs:$gaeVersion"
		management "com.google.appengine:appengine-api-stubs:$gaeVersion"
		management "com.google.appengine:appengine-testing:$gaeVersion"
		management "com.google.appengine:appengine:$gaeVersion"
		management "com.google.inject:guice:3.0"
		management "com.nimbusds:nimbus-jose-jwt:9.+"
		management "com.nimbusds:oauth2-oidc-sdk:9.+"
		management "com.squareup.okhttp3:mockwebserver:3.+"
		management "com.squareup.okhttp3:okhttp:3.+"
		management "com.sun.xml.bind:jaxb-core:2.+"
		management "com.sun.xml.bind:jaxb-impl:2.+"
		management "com.unboundid:unboundid-ldapsdk:4.+"
		management "commons-codec:commons-codec:1.14"
		management "commons-collections:commons-collections:3.+"
		management "commons-httpclient:commons-httpclient:3.+"
		management "commons-logging:commons-logging:1.2"
		management "io.projectreactor.tools:blockhound:1.+"
		management "io.rsocket:rsocket-core:${rsocketVersion}"
		management "io.rsocket:rsocket-transport-netty:${rsocketVersion}"
		management "javax.annotation:jsr250-api:1.+"
		management "javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.+"
		management "javax.servlet.jsp:javax.servlet.jsp-api:2.+"
		management "javax.servlet:javax.servlet-api:4.+"
		management "javax.validation:validation-api:2.+"
		management "javax.xml.bind:jaxb-api:2.+"
		management "junit:junit:4.12"
		management "ldapsdk:ldapsdk:4.+"
		management "net.sf.ehcache:ehcache:2.+"
		management "net.sourceforge.htmlunit:htmlunit:2.37.0"
		management "net.sourceforge.nekohtml:nekohtml:1.+"
		management "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:2.+"
		management "opensymphony:sitemesh:2.+"
		management "org.apache.directory.server:apacheds-core-entry:1.5.5"
		management "org.apache.directory.server:apacheds-core:1.5.5"
		management "org.apache.directory.server:apacheds-protocol-ldap:1.5.5"
		management "org.apache.directory.server:apacheds-protocol-shared:1.5.5"
		management "org.apache.directory.server:apacheds-server-jndi:1.5.5"
		management "org.apache.directory.shared:shared-ldap:0.9.15"
		management "org.apache.httpcomponents:httpclient:4.+"
		management "org.apache.taglibs:taglibs-standard-jstlel:1.+"
		management "org.aspectj:aspectjrt:$aspectjVersion"
		management "org.aspectj:aspectjtools:$aspectjVersion"
		management "org.aspectj:aspectjweaver:$aspectjVersion"
		management "org.assertj:assertj-core:3.+"
		management "org.bouncycastle:bcpkix-jdk15on:1.+"
		management "org.bouncycastle:bcprov-jdk15on:1.+"
		management "org.eclipse.jetty:jetty-server:9.4.19.v20190610"
		management "org.eclipse.jetty:jetty-servlet:9.4.19.v20190610"
		management "org.eclipse.persistence:javax.persistence:2.+"
		management "org.hibernate:hibernate-entitymanager:5.+"
		management "org.hibernate:hibernate-validator:6.+"
		management "org.hsqldb:hsqldb:2.+"
		management "org.jasig.cas.client:cas-client-core:3.+"
		management "org.jasig.cas:cas-server-webapp:4.0.7@war"
		management "org.mockito:mockito-core:3.3.+"
		management "org.openid4java:openid4java-nodeps:0.+"
		management "org.opensaml:opensaml-core:$openSamlVersion"
		management "org.opensaml:opensaml-saml-api:$openSamlVersion"
		management "org.opensaml:opensaml-saml-impl:$openSamlVersion"
		management "org.powermock:powermock-api-mockito2:2.+"
		management "org.powermock:powermock-api-support:2.+"
		management "org.powermock:powermock-core:2.+"
		management "org.powermock:powermock-module-junit4-common:2.+"
		management "org.powermock:powermock-module-junit4:2.+"
		management "org.powermock:powermock-reflect:2.+"
		management "org.python:jython:2.5.+"
		management "org.seleniumhq.selenium:htmlunit-driver:2.37.0"
		management "org.seleniumhq.selenium:selenium-java:3.+"
		management "org.seleniumhq.selenium:selenium-support:3.+"
		management "org.skyscreamer:jsonassert:1.+"
		management "org.slf4j:jcl-over-slf4j:1.+"
		management "org.slf4j:log4j-over-slf4j:1.+"
		management "org.slf4j:slf4j-api:1.+"
		management "org.springframework.ldap:spring-ldap-core:latest.release"
		management "org.synchronoss.cloud:nio-multipart-parser:1.+"
		management "org.thymeleaf:thymeleaf-spring5:3.+"
	}
}

configurations {
	all {
		resolutionStrategy {
			componentSelection {
				all { ComponentSelection selection ->
					def candidate = selection.getCandidate()
					def version = candidate.getVersion().toLowerCase()

					if (version.contains("alpha") || version.contains("beta")) {
						selection.reject("Rejecting $selection with version $version as alpha/beta")
					}

					if (candidate.getModule().equals("jsr250-api") && version.equals("1.0-20050927.133100")) {
						selection.reject("Rejecting $selection with version $version as invalid version")
					}
				}
			}
		}
	}
}
