mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-05-23 19:49:37 +00:00
[add] deploy artifacts to nexus
This commit is contained in:
parent
b7daf5bab0
commit
c46b19e1a9
3 changed files with 76 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -49,3 +49,4 @@ out/
|
|||
_site/
|
||||
*.css
|
||||
!petclinic.css
|
||||
gradle.properties
|
||||
|
|
47
build.gradle
47
build.gradle
|
@ -7,7 +7,10 @@ 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'
|
||||
}
|
||||
// version '1.2'
|
||||
|
||||
version = scmVersion.version
|
||||
|
||||
apply plugin: 'java'
|
||||
|
@ -20,6 +23,8 @@ group = 'org.springframework.samples'
|
|||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
// archiveName = 'spring-petclinic'
|
||||
// version = '0.1.3-SNAPSHOT'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
@ -100,4 +105,44 @@ task showInBrowser {
|
|||
}
|
||||
|
||||
tasks.named("showInBrowser").configure{ dependsOn ("build") }
|
||||
tasks.named("showInBrowser").configure{ dependsOn("test") }
|
||||
tasks.named("showInBrowser").configure{ dependsOn("test") }
|
||||
|
||||
// Maven Publish Configuration
|
||||
|
||||
def nexusUrl = 'http://localhost:8081/repository/maven-snapshots'
|
||||
def nexusUsername = project.hasProperty('nexusUsername') ? project.nexusUsername : System.getenv('NEXUS_USERNAME')
|
||||
def nexusPassword = project.hasProperty('nexusPassword') ? project.nexusPassword : System.getenv('NEXUS_PASSWORD')
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
|
||||
artifact file("${buildDir}/libs/spring-petclinic-${version}.jar")
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url nexusUrl
|
||||
allowInsecureProtocol = true
|
||||
credentials {
|
||||
username nexusUsername
|
||||
password nexusPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("publish").configure{ dependsOn("build")}
|
||||
tasks.named("publish").configure{dependsOn("bootJar")}
|
||||
tasks.named("publishMavenJavaPublicationToMavenRepository").configure{ dependsOn("bootJar")}
|
||||
|
||||
task testProxy {
|
||||
doLast {
|
||||
def url = new URL('http://localhost:8081/repository/maven-central')
|
||||
def connection = url.openConnection()
|
||||
connection.connect()
|
||||
println "Proxy connection successful to Maven Central!"
|
||||
}
|
||||
}
|
||||
|
|
31
pom.xml
31
pom.xml
|
@ -17,6 +17,19 @@
|
|||
<tag>spring-petclinic-4.0.2</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>nexus-releases</id>
|
||||
<url>http://localhost:8081/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>nexus-snapshots</id>
|
||||
<url>http://localhost:8081/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
|
||||
|
||||
<groupId>org.springframework.samples</groupId>
|
||||
<artifactId>spring-petclinic</artifactId>
|
||||
<version>4.0.3-SNAPSHOT</version>
|
||||
|
@ -287,8 +300,22 @@
|
|||
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Spring Boot Actuator displays sbom-related information if a CycloneDX SBOM file is
|
||||
present at the classpath -->
|
||||
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nxrm3-maven-plugin</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<nexusUrl>http://localhost:8081</nexusUrl>
|
||||
|
||||
<serverId>nexus-snapshots</serverId>
|
||||
|
||||
<repository>maven-snapshots</repository>
|
||||
|
||||
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<?m2e ignore?>
|
||||
<groupId>org.cyclonedx</groupId>
|
||||
|
|
Loading…
Reference in a new issue