diff --git a/build.gradle b/build.gradle index 3d7aa5192..b80135c53 100644 --- a/build.gradle +++ b/build.gradle @@ -7,6 +7,7 @@ plugins { id 'io.spring.javaformat' version '0.0.43' id "io.spring.nohttp" version "0.0.11" id("pl.allegro.tech.build.axion-release") version "1.18.7" + id 'maven-publish' } apply plugin: 'java' @@ -23,8 +24,41 @@ java { sourceCompatibility = JavaVersion.VERSION_17 } +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } + repositories { + maven { + name = "Nexus" + url = uri("http://localhost:8081/repository/maven-releases/") + allowInsecureProtocol = true + credentials { + username = "admin" + password = System.getenv("NEXUS_PASSWORD") + } + } + } +} + +tasks.register('publishToNexus') { + dependsOn publish +} + repositories { - mavenCentral() + repositories { + maven { + url "http://localhost:8081/repository/maven-central/" + allowInsecureProtocol = true + credentials { + username = "admin" + password = System.getenv("NEXUS_PASSWORD") + } + } +} + } ext.checkstyleVersion = "10.20.0" diff --git a/pom.xml b/pom.xml index 3337840d7..c7a0a9920 100644 --- a/pom.xml +++ b/pom.xml @@ -21,11 +21,11 @@ petclinic - - local-repo - file:////Users/idvylyuk/local-maven-repo - - + + nexus-snapshots + http://localhost:8081/repository/maven-snapshots/ + + @@ -156,6 +156,33 @@ + + org.apache.maven.plugins + maven-deploy-plugin + ${maven-deploy-plugin.version} + + true + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.5.1 + + + default-deploy + deploy + + deploy + + + + + nexus + http://localhost:8081/nexus/ + true + + org.apache.maven.plugins maven-release-plugin