diff --git a/Jenkins_jfrog b/Jenkins_jfrog new file mode 100644 index 0000000..66bdc3e --- /dev/null +++ b/Jenkins_jfrog @@ -0,0 +1,46 @@ +pipeline{ + agent {label 'build'} + environment { + //ARTIFACTORY_URL = 'https://my-artifactory.com' + ARTIFACTORY_REPO = 'maven' + //ARTIFACTORY_CREDENTIALS_ID = 'artifactory-credentials-id' // Jenkins credentials ID + } + stages{ + stage('Git Checkout Stage'){ + steps{ + git branch: 'main', url: 'https://github.com/Divyamarathi/java-example.git' + } + } + stage('Build Stage'){ + steps{ + sh 'mvn clean install' + } + } + /* stage('SonarQube Analysis Stage') { + steps{ + withSonarQubeEnv('sonarqube-server') { + sh "mvn clean verify sonar:sonar" + } + } + }*/ + stage('Publish Artifacts') { + steps { + script { + // Publish the artifact to Artifactory + def server = Artifactory.server('jfrog') + def uploadSpec = """{ + "files": [{ + "pattern": "target/*.war", + "target": "maven/java_example.war" + }] + }""" + server.upload(uploadSpec) + } + } + } + + + + + } +} diff --git a/Jenkinsfile b/Jenkinsfile index 171e3d4..e481b62 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,9 +1,9 @@ pipeline{ - agent {label 'angular'} + agent {label 'build'} stages{ stage('Git Checkout Stage'){ steps{ - git branch: 'main', url: 'https://github.com/sudheer76R/java-example.git' + git branch: 'main', url: 'https://github.com/Divyamarathi/java-example.git' } } stage('Build Stage'){