3.2 KiB
3.2 KiB
name, description
| name | description |
|---|---|
| sonarqube-plugin-development | Use when adding or changing Java plugin entry points, extension registration, properties, web services, manifest metadata, or packaging compatibility for SonarQube Community Build 25.9.0.112764. |
SonarQube plugin development
- Target SonarQube Community Build
25.9.0.112764; use Java 17 bytecode and the matching public plugin API (13.0.0.3026, confirmed from the target server dependency metadata). - Declare all server extensions through
Plugin.Context.addExtensions; keep constructors free of service work. - Use only
org.sonar.api.*public API. Never importorg.sonar.server.*, DAO classes, or implementation packages. - Define settings through
PropertyDefinition; secured values must use a.securedkey and PASSWORD type. - Add web services using
WebServiceand@ServerSide; authorize each action explicitly. - Inspect the pinned API JAR before importing any auth type.
org.sonar.api.user.UserSessionandorg.sonar.api.permissions.GlobalPermissionare absent from API 13.0.0.3026. The current implementation reads current-user permissions through the publicRequest.localConnector()interface and must be checked against the target server's response. - Set key, display name, version and minimum plugin API version in packaging metadata. The manifest
Sonar-Versionis an API version, not a SonarQube product release. Keep the minimum tested server release separately. - Use SLF4J supplied by the host; never package logging implementations or log credentials.
- Verify extension APIs against the exact API artifact/Javadoc when changing the target release.
- For project creation, prefer the browser's same-origin public SonarQube REST call when the logged-in user's session must be preserved; do not invoke internal project creation services from a plugin endpoint.
Checklist
- Entry point and only public API types.
- Extensions registered and server side scoped correctly.
- Secure configuration and explicit authorization.
- Manifest key/name/version/minimum version inspected in final JAR.
mvnw verifysucceeds.
Sources
- SonarQube Community Build Plugin basics: https://docs.sonarsource.com/sonarqube-community-build/extension-guide/developing-a-plugin/plugin-basics (consulted 2026-10-28)
- SonarSource API compatibility matrix: https://github.com/SonarSource/sonar-plugin-api (consulted 2026-10-28)
- SonarQube target dependency metadata: https://central.sonatype.com/artifact/org.sonarsource.sonarqube/sonar-core/25.9.0.112764 (consulted 2026-10-28)
- Pinned API source artifact: https://repo.maven.apache.org/maven2/org/sonarsource/api/plugin/sonar-plugin-api/13.0.0.3026/sonar-plugin-api-13.0.0.3026-sources.jar (consulted 2026-10-28)
- SonarQube project creation REST API: https://docs.sonarsource.com/sonarqube-community-build/project-administration/creating-project/automating-creation (consulted 2026-10-28)
Not verified
- Full target-tag SonarQube source checkout was not available; API pin follows target dependency metadata and the published 25.8/25.10 compatibility table.
- The target server's
api/users/currentpermissions response and local connector caller context were not tested live.