This is an automated email from the ASF dual-hosted git repository. drazzib pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/gora.git
The following commit(s) were added to refs/heads/master by this push: new 8050253 GORA-675: Perform Sonar static code analysis on Jenkins (#239) 8050253 is described below commit 80502535c510c44690028468d13e52c53f0fb934 Author: Damien Raude-Morvan <draz...@apache.org> AuthorDate: Fri May 7 22:07:47 2021 +0200 GORA-675: Perform Sonar static code analysis on Jenkins (#239) * GORA-675: Jenkinsfile: include Code Quality * GORA-675: Jenkinsfile: Use Java 11 SonarCloud Code Quality * GORA-675: Exclude "jdk.tools" as dependency (transitive dependency from hadoop-annotations) --- Jenkinsfile | 19 +++++++++++++++++++ gora-hive/pom.xml | 24 ++++++------------------ gora-jet/pom.xml | 6 ++++++ gora-solr/pom.xml | 4 ++++ pom.xml | 10 ++++++++++ 5 files changed, 45 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9c8bd3f..31c880d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -62,6 +62,9 @@ pipeline { // --show-version Display version information WITHOUT stopping build // --no-transfer-progress Do not display transfer progress when downloading or uploading MAVEN_CLI_OPTS = "--batch-mode --errors --fail-at-end --show-version --no-transfer-progress" + // https://cwiki.apache.org/confluence/display/INFRA/SonarQube+Analysis + // https://sonarcloud.io/documentation/analysis/scan/sonarscanner-for-maven/ + SONARCLOUD_PARAMS = "-Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_gora" } stages { @@ -100,5 +103,21 @@ pipeline { sh "mvn $MAVEN_CLI_OPTS --activate-profiles release -DskipTests deploy" } } + + stage('Code Quality') { + // https://sonarcloud.io/documentation/appendices/move-analysis-java-11/ + // "continue building in Java 8 but will use Java 11 to scan the code" + // https://cwiki.apache.org/confluence/display/INFRA/JDK+Installation+Matrix + tools { + jdk 'jdk_11_latest' + } + steps { + echo 'Checking Code Quality on SonarCloud' + // 'drazzib-sonarcloud-token' needs to be defined for this job and contains the user token + withCredentials([string(credentialsId: 'drazzib-sonarcloud-token', variable: 'SONAR_TOKEN')]) { + sh "mvn sonar:sonar ${SONARCLOUD_PARAMS} -Dsonar.branch.name=${BRANCH_NAME}" + } + } + } } } diff --git a/gora-hive/pom.xml b/gora-hive/pom.xml index e1ae565..6485185 100644 --- a/gora-hive/pom.xml +++ b/gora-hive/pom.xml @@ -163,40 +163,28 @@ <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> <version>${hadoop-common.version}</version> + <exclusions> + <exclusion> + <groupId>jdk.tools</groupId> + <artifactId>jdk.tools</artifactId> + </exclusion> + </exclusions> </dependency> <!-- Hive Dependencies --> <dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-jdbc</artifactId> - <exclusions> - <exclusion> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-service</artifactId> - <exclusions> - <exclusion> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-exec</artifactId> - <exclusions> - <exclusion> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> diff --git a/gora-jet/pom.xml b/gora-jet/pom.xml index 36b1734..1a6fb56 100644 --- a/gora-jet/pom.xml +++ b/gora-jet/pom.xml @@ -112,6 +112,12 @@ <artifactId>hadoop-common</artifactId> <version>2.5.2</version> <scope>test</scope> + <exclusions> + <exclusion> + <groupId>jdk.tools</groupId> + <artifactId>jdk.tools</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> diff --git a/gora-solr/pom.xml b/gora-solr/pom.xml index eb75af7..b144a84 100644 --- a/gora-solr/pom.xml +++ b/gora-solr/pom.xml @@ -181,6 +181,10 @@ <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> </exclusion> + <exclusion> + <groupId>jdk.tools</groupId> + <artifactId>jdk.tools</artifactId> + </exclusion> </exclusions> </dependency> <dependency> diff --git a/pom.xml b/pom.xml index c864136..8b497ca 100755 --- a/pom.xml +++ b/pom.xml @@ -1820,6 +1820,12 @@ <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-minicluster</artifactId> <version>${hadoop-2.test.version}</version> + <exclusions> + <exclusion> + <groupId>jdk.tools</groupId> + <artifactId>jdk.tools</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> @@ -1898,6 +1904,10 @@ <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl</artifactId> </exclusion> + <exclusion> + <groupId>jdk.tools</groupId> + <artifactId>jdk.tools</artifactId> + </exclusion> </exclusions> </dependency>