Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 1.71 KB

File metadata and controls

31 lines (23 loc) · 1.71 KB

Sonarqube Java Energy Impact Plugin

This repo provide a SonarQube plugin with the purpose to guide Java developers to write more energy efficient Java applications with the aim to reduce the carbon footprint of Java software.

For example, the plugin makes results of Improving energy-efficiency by recommending Java collections approachable so that the CI pipeline of Java developers recommends energy efficient code alternatives.

Install

Download the plugin from Jitpack.io or from the list below and put the JAR file into <sonarqubeHome>/extensions/plugins] to activate it.

Development

  • Build the Java artifact
    mvn package
    
  • Start a Docker Image with remote debugging:
    docker run --rm -it -e SONAR_WEB_JAVAADDITIONALOPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005 -v "/path/to/project/target/sonarqube-java-energyimpact-plugin-<version>-SNAPSHOT.jar:/opt/sonarqube/extensions/plugins/energy-impact.jar" -v sq-data:/opt/sonarqube/data -p 9000:9000 -p 5005:5005 --name sq sonarqube:lts
    
  • Attach to remote debugging port with the IDE of your choice
  • Run a Sonarqube analysis on a Maven/Java project
    mvn sonar:sonar -Dsonar.host.url=http://localhost:9000 -Dsonar.login=<token created in the settings>