Skip to content
Open

Main #28

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
pipeline {
agent any
environment {
PATH = "/opt/maven/bin:$PATH"
}
stages {
stage('Build') {
steps {
sh 'mvn clean install'
}
}

stage('SonarQube Analysis') {
environment {
scannerHome = tool 'bharath-sonarqube-scanner'
}
steps {
withSonarQubeEnv('Bharath-SonarQube-Server') {
sh "${scannerHome}/bin/sonar-scanner"
}
}
}

stage('Quality Gate') {
steps {
script {
timeout(time: 1, unit: 'hours') { // Corrected 'Hours' -> 'hours'
def qg = waitForQualityGate() // Fixed function name
if (qg.status != 'OK') { // Ensure 'OK' is capitalized correctly
error "Pipeline aborted due to Quality Gate failure: ${qg.status}"
}
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# sparkjava-war-example
Build war with maven and sparkjava framework

Steps:
Steps:-

1. Download a fresh [Tomcat 8 distribution](https://tomcat.apache.org/download-80.cgi)
2. Clone this repository to your local machine
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
22 changes: 22 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Required metadata
sonar.verbose=true
sonar.organization=bharathkumars-key
sonar.projectKey=bharathkumars-key_bharathtrend
sonar.projectName=bharathtrend
sonar.projectVersion=1.0

# Path settings
sonar.sources=src
#sonar.tests=tests
sonar.language=java
sonar.java.binaries=target/classes

# Optional settings
sonar.sourceEncoding=UTF-8
#sonar.exclusions=**/*.json,**/*.xml
sonar.test.inclusions=**/*Test.java

# Coverage (if using Jacoco)
#sonar.jacoco.reportPaths=target/jacoco.exec
sonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml