SonarQube Runner fails on a file having comma in its name - sonarqube-msbuild-runner

SonarQube: 5.2
Scanner For MSBuild: 1.0.2
Below line exists in FilesToAnalyze.txt deep inside .sonarqube folder
...Help\User\Duplicating,_Renaming,_Deleting_a_Blueprint.htm
And, MSBuild.SonarQube.Runner.exe end throws below exception. Notice how file name is truncated just before first comma in file name.
Caused by: java.lang.IllegalStateException: The folder 'C:\<full\path>\Help\User\Duplicating' does not exist for '<sonar:key>:509A1B17-E264-4DF5-99FC-AF27D064FBC4' (base directory = <dir containing .sonarqube>)
I decided to exclude the folder containing Help\User\ by passing /d:sonar.exclusions="**\<parentDir>\Help\**". This has no effect.
Is there an issue in Sonar Runner if file names contained comma?
Why doesn't sonar.exclusions have any effect?
Finally, log message states ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging. How do I pass -X switch to Sonar Runner from MSBuild.SonarQube.Runner.exe. Is it in the begin command or end command?

This is indeed a known issue.
Please refer to https://jira.sonarsource.com/browse/SONARMSBRU-199 for details as to when it will be fixed.

Related

IntelliJ throws "init terminating in do_boot", but same erl command works in Windows command line

Setup: IntelliJ IDEA 2022.2.2, Erlang 25.0
I am trying to run the Erlang code available at https://erlangbyexample.org/send-receive. I am able to run in werl and Windows command line. But I am getting the error "init terminating in do_boot" when I run in IntelliJ.
I checked a similar issue reported in this question , wherein the solution was to convert list input to integer/s. However, my Erlang code does not expect any input, it just expects the function name.
Please provide a pointer to resolve the issue.
"C:\Program Files\Erlang OTP\bin\erl.exe" -pa F:/1TB/P/workspace-IntelliJ-Erlang1/out/production/workspace-IntelliJ-Erlang1 -pa F:/1TB/P/workspace-IntelliJ-Erlang1 -eval send_recv:run(). -s init stop -noshell
{"init terminating in do_boot",{undef,[{send_recv,run,[],[]},{erl_eval,do_apply,7,[{file,"erl_eval.erl"},{line,744}]},{init,start_it,1,[{file,"init.erl"},{line,1234}]},{init,start_em,1,[{file,"init.erl"},{line,1220}]},{init,do_boot,3,[{file,"init.erl"},{line,910}]}]}}
init terminating in do_boot ({undef,[{send_recv,run,[],[]},{erl_eval,do_apply,7,[{_},{_}]},{init,start_it,1,[{_},{_}]},{init,start_em,1,[{_},{_}]},{init,do_boot,3,[{_},{_}]}]})
Crash dump is being written to: erl_crash.dump...done
I configured RunConfiguration to BUILD before RUNNING ("Before launch" section). As result, RunConfiguration was creating an empty folder "../out/production/workspace-IntelliJ-Erlang1" without .beam files, if the folder does not exist. It would delete any existing .beam files if the folder exists. Hence, the RUN was failing eventually.
As a workaround, I removed the BUILD before RUNNING option from RunConfiguration. And, I manually built using BuildProject before RunConfiguration.
TODO: I will check why was not RunConfiguration able to generate the .beam file.
Check if there is a file called send_recv.beam in either of the directories specified as code path in the -pa arguments. (The undef error means that it can't find the function send_recv:run/0, more often than not because it can't find the compiled module.)
My guess is that this file is actually in the directory where you ran Erlang from the command prompt, but IntelliJ runs Erlang using another working directory. The current working directory is part of the code path by default, which would be why this works from the command prompt but not within IntelliJ.

Loading pre-compiled files thorugh feature files in Karate [duplicate]

I am attempting to execute my tests using the karate stand-alone jar. Throughout my project, I use the read('classpath:') when locating files.
However, when I attempt to execute my tests from the CLI, I receive the following error:
src.test.java.Users.getUser: -unknown-:6 - javascript evaluation failed: read('classpath:commonUtils.feature'), java.io.FileNotFoundException: commonUtils.feature (The system cannot find the file specified)
Command: java -jar -Dkarate.config.dir="src/test/java" karate.jar -e DEV -t #tests src/test
It seems that I will have to declare the classpath on execution, would you be able to provide some insight on how to do this please? I'm not sure whether my issue is linked to [karate][standalone] Error : could not find or read file
Can you try the ZIP release and if you open the karate batch file you will see this:
java -cp karate.jar:. com.intuit.karate.Main $*
So the trick to setting a custom classpath is to use the com.intuit.karate.Main entry point and in the above example the current dir is also added to the classpath.
It would be great if you try the current RC version (0.9.5.RC3) to ensure we have everything working as expected.
For more information, see this part of the docs: https://github.com/intuit/karate/tree/develop/karate-netty#custom-classpath

I am getting Class not found exception even passing jar file [duplicate]

I am attempting to execute my tests using the karate stand-alone jar. Throughout my project, I use the read('classpath:') when locating files.
However, when I attempt to execute my tests from the CLI, I receive the following error:
src.test.java.Users.getUser: -unknown-:6 - javascript evaluation failed: read('classpath:commonUtils.feature'), java.io.FileNotFoundException: commonUtils.feature (The system cannot find the file specified)
Command: java -jar -Dkarate.config.dir="src/test/java" karate.jar -e DEV -t #tests src/test
It seems that I will have to declare the classpath on execution, would you be able to provide some insight on how to do this please? I'm not sure whether my issue is linked to [karate][standalone] Error : could not find or read file
Can you try the ZIP release and if you open the karate batch file you will see this:
java -cp karate.jar:. com.intuit.karate.Main $*
So the trick to setting a custom classpath is to use the com.intuit.karate.Main entry point and in the above example the current dir is also added to the classpath.
It would be great if you try the current RC version (0.9.5.RC3) to ensure we have everything working as expected.
For more information, see this part of the docs: https://github.com/intuit/karate/tree/develop/karate-netty#custom-classpath

CodePipeline ElasticBeanstalk [ERROR] An error occurred during execution of command [app-deploy] - [CheckProcfileForDotNetCoreApplication]

I've built a Code Pipeline (Source > Build > Deploy) and it's failing on the deploy step.
It's a Net Core 3.1 Api project.
I check the elastic beanstalk logs and I see:
2020/07/02 14:14:00.600060 [ERROR] An error occurred during execution of command [app-deploy] - [CheckProcfileForDotNetCoreApplication]. Stop running the command. Error: error stat /var/app/staging/MyApi/MyApi.dll: no such file or directory with file /var/app/staging/MyApi/MyApi.dll
As far as I know I have no control over /var/app/staging/ and this is built in AWS stuff?
The build step is working so I am unsure on this error.
My buildspec.yml is:
version: 0.2
phases:
build:
commands:
- dotnet publish -c release -o ./build_output ./MyApi/MyApi.csproj
artifacts:
files:
- '**/*'
base-directory: 'build_output'
This is the "zipfile/build_output" folder:
This is the zip file root folder:
These are the files in the build artifacts zip file that pipeline is using. The error says it cannot find MyAppName.dll (renamed to MyApi in the pic). It's there so I wonder why the problem.
Perhaps it doesnt like the folder structure in the zip file - see pic.
I had the same problem.
In my case, if the solution name and project name were different, I got the same error when I deployed the code from Visual Studio to Beanstalk, but when I added a project with the same name as the solution name and built it, I didn't get an error.
I suspect that there will be behavior during deployment that assumes the .dll file has the same name as the solution name.
Warning: This is a workaround, not a solution!
On the project that's failing to deploy, change the "Assembly name" in Project Properties / Application tab, to the name of the DLL it's missing (typically the solution name or the first period-separated part of the namespace).
i.e. "SLNNAME"
Then, redeploy your beanstalk app and it should work.
As Marcin correctly noticed, the indentation was incorrect for the "base-directory"
base-directory: 'build_output'
Should be
base-directory: 'build_output'
As others have noted, it is looking for only the first part of your project name .dll. In my case, my project and Assembly name were both UC.Web which yielded the error during deployment:
Error: error stat /var/app/staging/UC.dll: no such file or directory with file /var/app/staging/UC.dll
My solution that worked was I renamed my Assembly name from UC.Web to simply UC and it deployed successfully. While a solution for everyone, it is a workaround for the time being until Amazon fixes this.

Maven Error while running my selenium project in jenkins

When running the top level maven target
test
I get the following error:
FATAL: command execution failed
java.io.IOException: Cannot run program "mvn" (in directory "/var/lib/jenkins /jobs/selenium/workspace"): java.io.IOException: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:709)
at hudson.Launcher$ProcStarter.start(Launcher.java:338)
at hudson.Launcher$ProcStarter.join(Launcher.java:345)
at hudson.tasks.Maven.perform(Maven.java:263)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:717)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
at hudson.model.Run.execute(Run.java:1502)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.<init>(UNIXProcess.java:164)
at java.lang.ProcessImpl.start(ProcessImpl.java:81)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:468)
... 15 more
Build step 'Invoke top-level Maven targets' marked build as failure
This seems to be an issue concerning the maven pathway, but I've setup the maven pathway on my host machine. M2_HOME, M2, and PATH are all correct. I know they are correct because I can run the maven commands from the command line. When I try to invoke maven commands in jenkins though I get the error.
So I went into Jenkins->Manage Jenkins->Configure System and I clicked on Maven installations...
I checked off on
Install automatically
Version 2.2.1
I clicked save and tried to run my project again with the same error. When I do mvn -version I get 2.2.1 so that should be right.
From the Configure System page I have also tried
Name default
MAVEN_HOME /usr/local/apache-maven/apache-maven-2.2.1
Any ideas?
The solution to my question has two parts. First I needed to make sure that after creating the maven Installation setup on the Configure System page, that I specified that same configuration in the build itself. Second Jenkins does not seem to have sufficient privileges on the redhat box I'm running it on. Once I finally got it pointed to the right maven instance I got a lot of unable to create file/folder errors. These permission errors could be the real reason I had so much trouble with maven on this machine. I have not solved these permission errors and will create a new question for them.