Created
November 27, 2018 10:27
-
-
Save iskandarsaleh/7dc94f0d031d5ec170fd97f0e3292130 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node { | |
def mvnHome | |
stage('Preparation') { // for display purposes | |
// Get some code from a GitHub repository | |
git 'https://github.com/jglick/simple-maven-project-with-tests.git' | |
// Get the Maven tool. | |
// ** NOTE: This 'M3' Maven tool must be configured | |
// ** in the global configuration. | |
mvnHome = tool 'maven-1' | |
} | |
stage('Build') { | |
// Run the maven build | |
if (isUnix()) { | |
sh "'${mvnHome}/bin/mvn' -Dmaven.test.failure.ignore clean package" | |
} else { | |
bat(/"${mvnHome}\bin\mvn" -Dmaven.test.failure.ignore clean package/) | |
} | |
} | |
stage('SonarQube analysis') { | |
// requires SonarQube Scanner 2.8+ | |
def scannerHome = tool name: 'maven-1', type: 'maven'; | |
withSonarQubeEnv('sonar-6') | |
{ | |
sh "${mvnHome}/bin/mvn sonar:sonar" | |
} | |
} | |
stage('Results') { | |
junit '**/target/surefire-reports/TEST-*.xml' | |
archive 'target/*.jar' | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<build> | |
<pluginManagement> | |
<plugins> | |
<plugin> | |
<groupId>org.sonarsource.scanner.maven</groupId> | |
<artifactId>sonar-maven-plugin</artifactId> | |
<version>3.5.0.1254</version> | |
</plugin> | |
</plugins> | |
</pluginManagement> | |
</build> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment