diff --git a/build.gradle b/build.gradle index 316dee5da012..d074f6bc4107 100644 --- a/build.gradle +++ b/build.gradle @@ -444,3 +444,7 @@ configure(rootProject) { tasks.named('build').configure { finalizedBy('publishToMavenLocal') } + +tasks.named('publish').configure { + dependsOn('build') +} diff --git a/gradle/spring-module.gradle b/gradle/spring-module.gradle index a30f378c53f0..43012f5aa877 100644 --- a/gradle/spring-module.gradle +++ b/gradle/spring-module.gradle @@ -95,6 +95,19 @@ publishing { artifact javadocJar } } + + repositories { + maven { + name 'nexus' + url = System.getenv("NEXUS_REPO_URL") ? System.getenv("NEXUS_REPO_URL") : + "https://maven.wso2.org/nexus/service/local/staging/deploy/maven2/" + credentials { + username rootProject.hasProperty("nexus_username") ? nexus_username : System.getenv("NEXUS_USERNAME") + password rootProject.hasProperty("nexus_password") ? nexus_password : System.getenv("NEXUS_PASSWORD") + } + allowInsecureProtocol = false + } + } } // Disable publication of test fixture artifacts. @@ -104,3 +117,7 @@ components.java.withVariantsFromConfiguration(configurations.testFixturesRuntime tasks.named('build').configure { finalizedBy('publishToMavenLocal') } + +tasks.named('publish').configure { + dependsOn('build') +}