I'm working on a declarative Jenkins pipeline script to build and publish the artifact to JFrog Artifactory.
We have only one project repository and the services are under services folder. All the services have its own pom.xml .We need to write a script to pipeline script to build and publish the artifact to JFrog only when there is a change detected in the individual directory structure of services.
As per client , we cannot have individual repository for each services. The issue here, with the below script(using rtUpload) I'm unable to publish the artifacts as maven artifact( group id, artifact id and version number) to artifactory. Requesting your help on this.
The project structure is given below.
trinad(repository)
|
|-----/java/services/customer_quote/pom.xml
|
|-----/java/services/customer_rate/pom.xml
|
|-----/java/services/customer_renew/pom.xml
pipeline{
agent any
tools{
jdk 'JDK'
maven 'Maven'
}
stages{
stage('Build'){
when {
anyOf{
changeset '**/services/customer_quote/**'
}
}
steps{
sh 'mvn -v'
sh 'mvn -f java/services/customer_quote/pom.xml' clean install
}
when {
anyOf{
changeset '**/services/customer_rate/**'
}
}
steps{
sh 'mvn -v'
sh 'mvn -f java/services/customer_rate/pom.xml' clean install
}
}
stage('publish'){
when {
anyOf{
changeset '**/services/customer_quote/**'
}
}
steps{
rtUpload{
serverId:'Artifactory',
spec:'''{
"files":[
{
"pattern":"/services/customer_quote/target/customer-quote-*.jar",
"target": "trinad"/${BUILD_NUMBER}/"
}]
}
}
}
//publish steps for other services goes here
}
}
}
maven deployinstead ofrtUpload? - fmdaboville