I pre-provisioned a project before analysis, but the analysis changed the Display Name. Can I change it back without deleting the project and recreating it?
You can easily change a project’s name at its next analysis using the
sonar.projectName parameter. In fact, that’s very likely how it got changed the first time. Depending on your build/analysis technology, you may need to override the value picked up automatically from the project itself by passing
-Dsonar.projectName=[new name] on the analysis command line.
Hmm, that doesn’t match with documentation. The page located here: https://sonarcloud.io/documentation/analysis/analysis-parameters/
states “If there is already a name in the DB, it won’t be overwritten”.
I was writing from memory. Your challenge pushed me to actually test, and the test showed that I’m right.
After squinting at the documentation for a few minutes, I sorted out my confusion. Here’s the passage you’re referring to:
<name>for Maven projects, otherwise project key. If there is already a name in the DB, it won’t be overwritten
The key point is that that’s in the “Default” column. In other words, the default value is the project key, but if you don’t provide a project name and a project name was previously set (by whatever method) then your existing project name won’t be overwritten with the project key.
That makes sense and matches with what I’m seeing. Thanks