-
Notifications
You must be signed in to change notification settings - Fork 304
Closed
Description
Description
I have the same use case than #413, i want to use git.branch
in sonar.projektKey
.
for that i am trying to use:
<replacementProperties>
<replacementProperty>
<property>sonar.projectKey</property>
<token>^.*$</token>
<value>${project.groupId}:${project.artifactId}:${git.branch}</value>
<regex>false</regex>
</replacementProperty>
</replacementProperties>
but i get:
[INFO] --- git-commit-id-plugin:4.0.0:revision (default-cli) @ test ---
[INFO] Current project: 'test', first project to execute based on dependency graph: 'test'
[INFO] dotGitDirectory K:\repos\git\auv-fachanwendung\.git
[INFO] Collected git.branch with value develop
[INFO] apply replace on property sonar.projectKey: original value 'null' with ''
[INFO] including property git.branch in results
[INFO] including property sonar.projectKey in results
Expected behavior
i expect that git.branch
gets replaced in sonar.projectKey
Additional context
- the plugin version is being used: 4.0.0
- the Java-Version is being used: Oracle JDK "1.8.0_172"
- the Maven-Version is being used: Apache Maven 3.6.3
- on what Operating System you experience the bug: Windows 10 Enterprise Build 17763
- in what context maven is being executed: Git-Bash 2.24.02 or IntelliJ 2019.3
- how maven is being executed:
mvn git-commit-id:revision
here the whole pom.xml to reproduce the problem:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>test</name>
<groupId>de.test</groupId>
<artifactId>test</artifactId>
<version>1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<sonar.projectKey>${project.groupId}:${project.artifactId}:${git.branch}</sonar.projectKey>
</properties>
<build>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.0</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<injectAllReactorProjects>true</injectAllReactorProjects>
<runOnlyOnce>true</runOnlyOnce>
<skipPoms>false</skipPoms>
<includeOnlyProperties>
<includeOnlyProperty>^git.branch$</includeOnlyProperty>
</includeOnlyProperties>
<verbose>true</verbose>
<!-- see: https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/413 -->
<replacementProperties>
<replacementProperty>
<property>sonar.projectKey</property>
<token>^.*$</token>
<value>${project.groupId}:${project.artifactId}:${git.branch}</value>
<regex>false</regex>
</replacementProperty>
</replacementProperties>
</configuration>
</plugin>
</plugins>
</build>
</project>
and the Output of mvn git-commit-id:revision
:
$ mvn git-commit-id:revision
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------------< de.test:test >----------------------------
[INFO] Building test 1-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- git-commit-id-plugin:4.0.0:revision (default-cli) @ test ---
[INFO] Current project: 'test', first project to execute based on dependency graph: 'test'
[INFO] dotGitDirectory C:\repos\git\test\.git
[INFO] Collected git.branch with value develop
[INFO] apply replace on property sonar.projectKey: original value 'null' with ''
[INFO] including property git.branch in results
[INFO] including property sonar.projectKey in results
[INFO] Added properties to 1 projects
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.922 s
[INFO] Finished at: 2019-12-03T17:16:31+01:00
[INFO] ------------------------------------------------------------------------
what can be wrong?
many thanks