You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In prior issue #79 the poster wanted to be able to run the "build-helper:add-source" goal from a command line. I have a similar desire and it is one where modifying the POM by adding an execution of the build-helper-maven-plugin's add-source goal doesn't cleanly solve the problem. I think that the code change required would be to simply add a name to the "sources" parameter by adding an argument to the @parameter annotation on that field in file AddSourceMojo.java. I didn't want to start by submitting a merge request though in case the response from the community is "don't do this, it's a bad idea".
Specifically, I'm maintaining automation that runs against a large and varied set of Maven projects. These include some multimodule projects that each produce a handful of shared libraries. I need to be able to add several custom scan report files as source files. These will then be used in last stage of my automation by "sonar-maven-plugin". Today, sonar-maven-plugin obtains the source directories from Maven and only pays attention to files in those locations so fails to include. For single-module projects a simple workaround of "setting -Dsonar.sources=." does the trick. Providing that plugin with the source paths for multimodule projects is tricky and seems to deserve to be done by informing Maven of the additional source path.
I'd like to be able to add source files without manipulating each project's pom file(s) and without using little-known Maven features such as build profiles that are defined in settings.xml or profiles.xml (the latter is deprecated).
Here's a specific example of what I'd like to be able to do from a command line:
<root of project codebase>$ mvn dependency:tree -DoutputFile=target/sonar-scan-reports/maven-dependency-tree.txt build-helper:add-source -DadditionalSourcePath="./src/custom-scan-reports/" org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar
This way file "maven-dependency-tree.txt" would be considered part of the codebase to be analyzed, would get generated for each submodule, and Maven would provide maven-sonar-plugin with a set of source paths that's correct for each submodule and that includes these reports.
The text was updated successfully, but these errors were encountered:
gjd6640
added a commit
to gjd6640/build-helper-maven-plugin
that referenced
this issue
Nov 7, 2022
In prior issue #79 the poster wanted to be able to run the "build-helper:add-source" goal from a command line. I have a similar desire and it is one where modifying the POM by adding an execution of the build-helper-maven-plugin's add-source goal doesn't cleanly solve the problem. I think that the code change required would be to simply add a name to the "sources" parameter by adding an argument to the @parameter annotation on that field in file AddSourceMojo.java. I didn't want to start by submitting a merge request though in case the response from the community is "don't do this, it's a bad idea".
Specifically, I'm maintaining automation that runs against a large and varied set of Maven projects. These include some multimodule projects that each produce a handful of shared libraries. I need to be able to add several custom scan report files as source files. These will then be used in last stage of my automation by "sonar-maven-plugin". Today, sonar-maven-plugin obtains the source directories from Maven and only pays attention to files in those locations so fails to include. For single-module projects a simple workaround of "setting -Dsonar.sources=." does the trick. Providing that plugin with the source paths for multimodule projects is tricky and seems to deserve to be done by informing Maven of the additional source path.
I'd like to be able to add source files without manipulating each project's pom file(s) and without using little-known Maven features such as build profiles that are defined in settings.xml or profiles.xml (the latter is deprecated).
Here's a specific example of what I'd like to be able to do from a command line:
<root of project codebase>$ mvn dependency:tree -DoutputFile=target/sonar-scan-reports/maven-dependency-tree.txt build-helper:add-source -DadditionalSourcePath="./src/custom-scan-reports/" org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar
This way file "maven-dependency-tree.txt" would be considered part of the codebase to be analyzed, would get generated for each submodule, and Maven would provide maven-sonar-plugin with a set of source paths that's correct for each submodule and that includes these reports.
The text was updated successfully, but these errors were encountered: