# Github Actions for Java 8 projects

**URL:** <https://community.sonarsource.com/t/github-actions-for-java-8-projects/85522>\
**Category:** SonarQube Server / Community Build\
**Tags:** maven, build-wrapper, sonarqube, java, scanner\
**Created:** [March 9, 2023, 9:21pm UTC](https://community.sonarsource.com/t/github-actions-for-java-8-projects/85522 "2023-03-09T21:21:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zorro](https://avatars.discourse-cdn.com/v4/letter/z/ad7895/32.png) [@zorro](https://community.sonarsource.com/u/zorro)\
**Post date:** [March 9, 2023, 9:21pm UTC](https://community.sonarsource.com/t/github-actions-for-java-8-projects/85522/1 "2023-03-09T21:21:29Z")

</div>

Hi,

We have **SonarQube 9.9 LTS version.** I am trying to build and analyze the Java 8 project using maven wrapper mvnw in GitHub actions.  
If I set Java 11 as $JAVA\_HOME for SonarQube analysis then my maven wrapper also uses the same $JAVA\_HOME to build.  
Also, If I set $JAVA\_HOME to 8 then the build is working but sonarqube is failing

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [March 10, 2023, 6:17pm UTC](https://community.sonarsource.com/t/github-actions-for-java-8-projects/85522/2 "2023-03-10T18:17:46Z")

</div>

Hi,

I see two options here:

- build and analyze in two separate steps (two separate `mvn` commands), each with its own Java version
- run the whole thing with Java 11 and [set the compile target](https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html) to Java 8

&nbsp;  
HTH,  
Ann

---

<div class="post-metadata">

**Author:** ![zorro](https://avatars.discourse-cdn.com/v4/letter/z/ad7895/32.png) [@zorro](https://community.sonarsource.com/u/zorro)\
**Post date:** [March 10, 2023, 7:04pm UTC](https://community.sonarsource.com/t/github-actions-for-java-8-projects/85522/3 "2023-03-10T19:04:41Z")

</div>

if I set two separate builds this takes longer time to complete the two build plan because mvn sonar does not just analyze/scan the project like NodeJS project first sonar build and test then analyze the project.
