I already changed the key, but the displayed Name stayed the same. How can I change that one?
If you have a sonar-project.properties file for your project, the name is specified thanks to the sonar.projectName=... property in that file.
If you are on a Maven project, this value comes from the the project name provided inside the root POM file.
Otherwise, you can set the name on the command line when running the analysis, usually with the -Dsonar.projectName=... argument.
Related
I have project with numerous of submodules located in different directories:
enter image description here
How you can see, the module name of IDEA (in []) differs from directory root. I've tried to modify it though Project Settings, but after gradle sync it returns to initial state.
Is it possible to configure Gradle to set module name according with directory name?
IDE takes the module name from the Gradle configuration, which is by default a project directory name. If you want to change it you can do so by adding the following in the settings.gradle file:
rootProject.name = 'newProjectName'
See also the Naming recommendations from Gradle.
I have seen the other 2 appends and added sonar.languages=COBOL to my sonar-project.properties file to no avail.
I think it's basically more a case of not understanding the documentation (or the latter never having been "idiot tested"").
My problem is as follows. My properties file contains the following entries:-
# sonar.sources=../../mfuser/seb/source/
sonar.sources=C:/mfuser/SEB/Source
sonar.cobol.file.suffixes=cbl,cpy
sonar.cobol.copy.suffixes=cpy
#
sonar.languages=COBOL
When I run the sonar-scanner bat file, I'm seeing output like this:-
WARN File C:\mfuser\seb\source\vvira20.cbl is ignored. It is not located in module basedir c:\sonar-scanner\bin
To me this gives the impression that I can point to the directory containing my COBOL code, but at the same time the actual code HAS to be in c:\sonar-scanner\bin. Surely, that can't be the case? If it is, what is the point with the sonar.sources entry in the properties file?
In addition, onece I get this working, is there some way of specifying a parm/wild card so as to analyze SPECIFIC files. I tried sonar.sources=C:/mfuser/SEB/Source/vno* but that didn't seem to make any difference.
Thanks
You ran sonar-scanner from its own directory instead of running from the project directory. As the documentation says:
Run the following command from the project base directory
sonar-scanner
This same documentation recommends to create the sonar-project.properties file at the root of the project directory and to set the "sonar.sources" property to a path which is relative to the sonar-project.properties file.
Alternatively, you may want to use the "sonar.projectBaseDir" property. See the documentation for analysis parameters.
We are migrating our project from Maven to Gradle. Our CI uses system properties like -Dwebdriver.type=firefox to set certain behaviour thus we don't want to hardcode such props in gradle.properties file etc. Is there a way to provide a system property with a dot in the name using command line?
If you run the following:
build.gradle:
logger.lifecycle("some.property ${System.properties['some.property']}")
with:
gradle -Dsome.property=lol
It should give you the expected output.
On mvn install, a directory get created in target whose name contains buildnumber/timestamp.
Now I run mvn assembler where I need to use the same directory. I can not recreate the name since timestamp would change.
How can I retrieve the file name? I know the location of the file in my project.
Bind maven-assemlby-plugin into the build life-cycle and let it run with the usual build and you have your information available during the assembly creation.
I'm writing a Maven project and I'd like to include a file in the generated WAR that will contain some build time information. Typically this will be things like
The build time/date stamp
The user name of the person who built the WAR
The version of the app as specified in the POM
These are all fairly easy as there are maven properties which will give me the information I need.
I'd also like to include the machine name. I know Windows stores this information in an environment variable called "COMPUTERNAME", while *nix uses the hostname command.
Is there some platform independent way of grabbing this information so that I can write it into my text file?
I did this by invoking the Maven Ant task. Within that I used the following Ant tasks:
<tstamp> to generate a timestamp property
<propertyfile> to create a properties file containing properties like the above timestamp, the username etc.
You could use the Ant <exec> task to execute hostname and nominate an output property to write this value into.
This created a properties file in the src/main/resources dir that I then embedded in the .war file
As Andrew Logvinov says,
Look up hostname from Maven
Thanks :-)