I am trying to do something that seems pretty basic but is giving me a lot of trouble. I am trying to copy the jar file that is built into a different directory but the build keep failing on that step. Here is my Jenkinsfile and the "Copy" step at the bottom is causing the failure.
pipeline {
agent any
stages {
stage("Clean Up"){
steps{
deleteDir()
}
}
stage("Clone Repo"){
steps {
bat "git clone https://github.com/CBoton/spring-boot-hello-world.git"
}
}
stage("Build"){
steps {
dir("spring-boot-hello-world") {
bat "mvn clean install"
}
}
}
stage("Test") {
steps {
dir("spring-boot-hello-world") {
bat "mvn test"
}
}
}
stage("Package") {
steps {
dir("spring-boot-hello-world") {
bat "mvn package"
}
}
post {
success {
dir("spring-boot-hello-world") {
archiveArtifacts 'target/*.jar'
}
}
}
}
stage("Copy"){
steps {
dir("spring-boot-hello-world"){
bat ("copy target/*.jar C:\\Users\\Curti\\Downloads")
}
}
}
}
}
How I have it now produces the following error
C:\ProgramData\Jenkins\.jenkins\workspace\spring\spring-boot-hello-world>copy target/*.jar C:\Users\Curti\Downloads
The syntax of the command is incorrect.
I have tried many variations for the path but can't get it to work. This is starting to drive me crazy because it seems like it would be so simple. Any help would be greatly appreciated.