I am trying to run a maven project to pick all properties from sonar-project.properties files instead passing as argument to maven command, below command works:
$mvn clean verify sonar:sonar -Dsonar.host.url=${sonar} -Dsonar.login=${sonar_token} …*
or works by defining sonar properties in pom.xml
or also works by using sonar scanner plugin.
But I have compulsion to use sonar-maven-plugin plugin due to some dependency issues. While defining sonar-project.properties file in root directory with all arguments as properties inside it and running:
$mvn clean verify sonar:sonar**
doesn’t pick properties from sonar-project.properties file.
Can somebody suggest or guide how can we achieve this, to get all properties from sonar properties files while running maven command.
Thanks in advance !
Maven projects cannot use sonar-project.properties. You need to define the properties directly in the pom.xml's <properties></properties> node like so, using the sonar.* pattern similar to the parameters in sonar-project.properties or apply them at the command line like system properties with -Dsonar.*:
As I mentioned in my detail, I have compulsion to use sonar-maven-plugin plugin due to some dependency issues.
Is there is any workaround or way so that i can use this approach.
$mvn clean verify sonar:sonar**
and able to pick properties from sonar-project.properties file.
Any workaround or approach to pick properties from sonar-project.properties file while running maven build.
No, you will have to insert your sonar properties in the pom.xml, which can be used with sonar-maven-plugin. If that doesn’t work, can you show logs showing the error?