# Unable to push Sonar Reports to SonarQube for Java 8 Maven Project

**URL:** <https://community.sonarsource.com/t/unable-to-push-sonar-reports-to-sonarqube-for-java-8-maven-project/75698>\
**Category:** SonarQube Server / Community Build\
**Tags:** sonarqube, java\
**Created:** [November 8, 2022, 3:17am UTC](https://community.sonarsource.com/t/unable-to-push-sonar-reports-to-sonarqube-for-java-8-maven-project/75698 "2022-11-08T03:17:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maheshbabu22.neeli](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@maheshbabu22.neeli](https://community.sonarsource.com/u/maheshbabu22.neeli)\
**Post date:** [November 8, 2022, 3:17am UTC](https://community.sonarsource.com/t/unable-to-push-sonar-reports-to-sonarqube-for-java-8-maven-project/75698/1 "2022-11-08T03:17:59Z")

</div>

Hi Team,

I would like to get some help to resolve my issue.

Currently, I have JAVA 8 Maven project which is pretty old one and there is no scope to upgrade to JAVA 11. And the pipeline I am using is Jenkins.

Here, I can successfully able to build and test JAVA 8 project and when I tried to do a Sonar Scan to push the results/reports to SonarQube it failed with incompatible version, which is asking to set JAVA\_HOME to Java 11.

So, i have tried to maintain two docker images one with Java 8 and one with Java 11. In Java 8 container I have done all the build and test, and In Java 11 container I run the sonar scan. Please find below.

```auto
container('java 8') {
      stage('Build') {
          echo 'echo "in Build"'
          sh '''
              java -version // Java version: 1.8.0_212, vendor: IcedTea, runtime: /usr/lib/jvm/java-1.8-openjdk/jre
              echo $JAVA_HOME // /usr/lib/jvm/java-1.8-openjdk
              mvn clean install
             '''
      }
  }

  
container('java 11 - sonar') {
      stage('Sonar Analysis') {
          echo 'echo "in Sonar Analysis"'
          sh '''
              java -version // Java version: 11.0.10, vendor: AdoptOpenJDK, runtime: /opt/java/openjdk
              echo $JAVA_HOME // /opt/java/openjdk
              mvn sonar:sonar
             '''
      }
  }

```

Now, I am receiving a different error saying that Could not find artifact jdk.tools:jdk.tools:jar:1.7 at specified path /opt/java/openjdk/…/lib/tools.jar.

Could you please help us how to come over this error without moving the code to java 11.

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [November 9, 2022, 10:36am UTC](https://community.sonarsource.com/t/unable-to-push-sonar-reports-to-sonarqube-for-java-8-maven-project/75698/2 "2022-11-09T10:36:43Z")

</div>

Hey there.

Ideally, the scan should be taking place in the same build environment as your build and having access to the build artifcacts, even if you are using a different version of Java to perform the scan. This would imply, in your setup, a container with both versions of Java installed (and switching between them before running `mvn sonar:sonar`
