diff --git a/.github/workflows/bump-versions.yaml b/.github/workflows/bump-versions.yaml
index 252bc164c..7a0de5071 100644
--- a/.github/workflows/bump-versions.yaml
+++ b/.github/workflows/bump-versions.yaml
@@ -17,6 +17,7 @@ jobs:
- uses: actions/checkout@v4
- run: |
sed -i 's/version=.*/version=${{ github.event.inputs.version }}/' gradle.properties
+ cd php-custom-rules-plugin/maven && mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${{ github.event.inputs.version }}
- uses: peter-evans/create-pull-request@v7
with:
author: ${{ github.actor }} <${{ github.actor }}>
diff --git a/php-custom-rules-plugin/README.md b/php-custom-rules-plugin/README.md
index 54117d1dc..8863c3d1a 100644
--- a/php-custom-rules-plugin/README.md
+++ b/php-custom-rules-plugin/README.md
@@ -1,5 +1,25 @@
# This example demonstrates how to write **Custom Rules** for SonarPHP.
+## Build
+
+### Gradle
+
+The default build system is Gradle. To build the project and run its unit tests, execute this command from the project's root directory:
+
+```shell
+./gradlew build
+```
+
+### Maven
+
+To use Maven instead of Gradle, replace the `build.gradle.kts` file with the `maven/pom.xml` file.
+
+This change will also require to build the plugin dependency manually by executing this command from the project's root directory:
+
+```shell
+./gradlew publishToMavenLocal
+```
+
## API Changes
### 3.39
diff --git a/php-custom-rules-plugin/build.gradle.kts b/php-custom-rules-plugin/build.gradle.kts
index 623639809..102187665 100644
--- a/php-custom-rules-plugin/build.gradle.kts
+++ b/php-custom-rules-plugin/build.gradle.kts
@@ -19,6 +19,7 @@ description = "PHP Custom Rules Example for SonarQube"
tasks.jar {
manifest {
+ // More details about the attributes here: https://docs.sonarsource.com/sonarqube/latest/extension-guide/developing-a-plugin/plugin-basics/
attributes(
mapOf(
"Plugin-ChildFirstClassLoader" to "false",
@@ -36,7 +37,7 @@ tasks.jar {
"Plugin-RequiredForLanguages" to "php",
"Plugin-SourcesUrl" to "https://github.com/SonarSource/sonar-php",
"Plugin-Version" to project.version,
- "Sonar-Version" to "9.9",
+ "Sonar-Version" to "9.13",
"SonarLint-Supported" to "true",
"Version" to project.version.toString(),
"Jre-Min-Version" to java.sourceCompatibility.majorVersion,
diff --git a/php-custom-rules-plugin/maven/pom.xml b/php-custom-rules-plugin/maven/pom.xml
new file mode 100644
index 000000000..797d54ddd
--- /dev/null
+++ b/php-custom-rules-plugin/maven/pom.xml
@@ -0,0 +1,109 @@
+
+
+
+ 4.0.0
+
+ org.sonar.samples.php
+ php-custom-rules-plugin
+ jar
+ 3.40-SNAPSHOT
+
+ SonarSource PHP Custom Rules Example
+ PHP Custom Rules Example for SonarQube
+
+
+
+ 10.13.0.2560
+ 10.7.0.96327
+ 5.10.3
+
+
+ 17
+
+
+ 17
+ 17
+ 17
+
+
+
+
+ org.sonarsource.api.plugin
+ sonar-plugin-api
+ ${version.sonar-plugin-api}
+ provided
+
+
+
+ org.sonarsource.php
+ php-frontend
+ ${project.version}
+ provided
+
+
+
+ org.junit.jupiter
+ junit-jupiter
+ ${version.junit-jupiter}
+ test
+
+
+
+ org.sonarsource.sonarqube
+ sonar-plugin-api-impl
+ ${version.sonarqube-plugin-api}
+ test
+
+
+
+ org.sonarsource.php
+ php-frontend
+ ${project.version}
+ test-fixtures
+ test
+
+
+
+
+
+
+ org.sonarsource.sonar-packaging-maven-plugin
+ sonar-packaging-maven-plugin
+
+
+ custom
+ PHP Custom Rules
+ org.sonar.samples.php.PHPCustomRulesPlugin
+ true
+ 9.13
+ php
+ true
+ ${jre.min.version}
+
+
+ true
+
+
+
+
+
+
+ maven-shade-plugin
+
+
+ package
+
+ shade
+
+
+ false
+ true
+ false
+
+
+
+
+
+
+
diff --git a/php-frontend/build.gradle.kts b/php-frontend/build.gradle.kts
index 71d5d7cb2..a9a44516e 100644
--- a/php-frontend/build.gradle.kts
+++ b/php-frontend/build.gradle.kts
@@ -3,6 +3,7 @@ plugins {
id("org.sonarsource.php.code-style-convention")
id("java-library")
id("java-test-fixtures")
+ id("maven-publish")
}
description = "SonarSource PHP Analyzer :: Frontend"
@@ -25,3 +26,14 @@ dependencies {
testFixturesImplementation(libs.sonar.plugin.api.impl)
}
+
+publishing {
+ repositories {
+ mavenLocal()
+ }
+ publications {
+ create("mavenJava") {
+ from(components["java"])
+ }
+ }
+}