SonarQube 6.1 Execute Analysis Permissions - maven

We would like to allow any user to run a SonarQube preview analysis (authenticated or not). However, we'd like to restrict whom can upload analysis to the server.
In order to allow all users to run preview analysis, the documentation indicates that the Anyone user needs access to Browse and Execute Analysis.
However, it seems that running the maven sonar plugin at the command line is still requiring sonar.login and sonar.password.
Additionally, we would like to limit who can upload analysis to only the sonar-administrator group.
Here is a screenshot of our project permissions:
Here is a screenshot of our Global permissions:
Unsuccessful command:
mvn -o org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar -Dsonar.analysis.mode=preview -Dsonar.branch=$BRANCH -Dsonar.host.url=$SONAR_URL -Dsonar.skipPackageDesign=true -Dsonar.report.export.path=sonar-report.json
Successful command:
mvn -o org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar -Dsonar.analysis.mode=preview -Dsonar.branch=$BRANCH -Dsonar.host.url=$SONAR_URL -Dsonar.skipPackageDesign=true -Dsonar.report.export.path=sonar-report.json -Dsonar.login=%SONAR_USERNAME% -Dsonar.password=%SONAR_PASSWORD%
Please help me fine-tune our access options so that we achieve the goal of allowing preview analysis but excluding the ability to push analysis.
Here is some excerpts of the failing job. I removed some of the details that are company specific.
> mvn -o org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar -Dsonar.analysis.mode=preview -Dsonar.branch=$BRANCH -Dsonar.host.url=$SONAR_URL -Dsonar.skipPackageDesign=true -Dsonar.report.export.path=sonar-report.json
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=512m; support was removed in 8.0
...
[INFO] Performing issue tracking
[INFO] 772/772 components tracked
[WARNING] Console report is deprecated. Use SonarLint CLI to have local reports of issues
[INFO]
------------- Issues Report -------------
+13 issues
+1 blocker
+1 critical
+3 major
+8 minor
-------------------------------------------
[INFO] Export issues to c:\Source\releases\vcmmigrationmgr\vcmmigrationmgr-app\target\sonar\sonar-report.json
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 35.933 s
[INFO] Finished at: 2017-04-25T10:59:46-05:00
[INFO] Final Memory: 100M/3582M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project vcmmigrationmgr-app: Not authorized. Analyzing this project requires to be authenticated. Please provide the values of the properties sonar.login and sonar.password. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Edit: I removed "Execute Analysis" from the Anyone permission. I also removed
"-Dsonar.report.export.path=sonar-report.json" from the command. I do not understand why preview mode is requiring a user name and password. Is there any way to allow anonymous users to run in preview mode?

Related

Maven Iterator/Invoker fails on Windows

I have a Windows 10 System where I don't have administrative rights. However, most Maven builds are working on that machine. For some reason I run into a problem with the Iterator Plugin. Even the example from https://github.com/khmarbaise/iterator-maven-plugin/blob/master/src/it/invokerBasicTest/pom.xml fails with this error:
[INFO] [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:<my home director>). Please verify you invoked Maven from the correct directory. -> [Help 1]
[INFO] [ERROR]
[INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[INFO] [ERROR]
[INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
[ERROR] ------ Maven call was NOT Ok. for iteration one ( return code: 1 )
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.567 s
[INFO] Finished at: 2020-05-08T10:04:40+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.soebes.maven.plugins:iterator-maven-plugin:0.5.0:invoker (default) on project invoker-basic-test: Maven call failed with return code 1 for iteration: one -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
So in other words, on that particular Windows system (I see that build working on Macs and other Windows machines), the invoker tries to find the pom.xml in my user home directory. And of course, I started the build in the right directory. The only significant thing what I have noticed on that Windows, the Environment variable MP_FORCE_USE_SANDBOX=1 is set.
-e and -X don't really help. Perhaps someone could help me out with some further hints in order to tackle down the problem.
Finally, I found out what the problem was. It's not really a maven or Iterator Problem, more of a misconfigured Windows problem. However, in case someone comes over something like this, it may be worth to check.
In my case it was a Registry Key. In Windows there is a Registry Key Autorun under
\HKEY_CURRENT_USER\Software\Microsoft\Command Processor
This Registry Key can control, in which directory a new cmd.exe will be started. In my case, there was cd /d C:\<myHomeDirectory>as a value. Which made the cmd.exe always start in my Home Directory. This caused my build to fail, because each iteration of the iterator supposably starts a new process in my Home Directory, which finally lets Maven search the desired pom.xml in my Home Directory.
For me the resolution for my problem is, change the Registry Key Autorun to the value cd.

can not create project for opendaylight With Maven Archetype

I want create project for opendaylight with Maven Archetype and import into eclipse but when type this code for create project
mvn archetype:generate -DarchetypeGroupId=org.OpenDaylight.controller -DarchetypeArtifactId=OpenDaylight-startup-archetype -DarchetypeRepository=https://nexus.OpenDaylight.org/content/repositories/public/ -DarchetypeCatalog=https://nexus.OpenDaylight.org/content/repositories/public/archetype-catalog.xml
this will make the error
Generating project in Interactive mode
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.004 s
[INFO] Finished at: 2018-04-30T19:47:52+04:30
[INFO] Final Memory: 14M/138M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-
plugin:3.0.1:generate (default-cli) on project standalone-pom: archetypeCatalog 'https://
nexus.OpenDaylight.org/content/repositories/public/archetype-catalog.xml' is not
supported anymore. Please read the plugin documentation for details. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the
following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/
MojoFailureException
how to can resolved this problem ?or create new project?
EDIT: This option is displayed when you check create simple project
I always prefer to start building the ODL application through Eclipse.
Select "Create Maven Project" and click next which will ask you to fill various details. Fill the details as follows:
Artifacts:
Group ID: org.opendaylight.yourprojectname
Artifact ID: yourprojectname
Version: 1.0.0-SNAPSHOT
packaging: pom
Parent
Group ID: org.opendaylight.odlparent
Artifact ID: bundle-parent
Version: 1.8.1-Carbon (or any other stable version)
wait for eclipse to download all related components.
PS: I am assuming you have your settings.xml file updated. If Not use this settings.xml to update your existing settings.xml accordingly
And now you are good to go.
The official documentation for how to use Maven archetype is here: http://docs.opendaylight.org/en/latest/developer-guide/developing-apps-on-the-opendaylight-controller.html
It was more or less broken in previous releases, and has recently been fixed on the master branch for the future Fluorine release; more details here: https://jira.opendaylight.org/browse/DOCS-60 and

Makefile for springboot application

I have a spring boot application.I am running it inside a vagrant box(centos).I use intelliJ IDEA.
I have created a Makefile and I am trying to run this application.
I have never worked with Makefile hence I am not confident about it.
Hence the question might seem easy for some of you.I tried to do a bit of research but I could not achieve any success in it.
My Makefile contains:-
install-mvn:
mvn :install
I opened a terminal and went to the location where my Makefile is located and then issue the 'make' command to run the application.
I get the error as below:-
[vagrant#localhost src]$ make
mvn :install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
[INFO] Total time: 0.578s
[INFO] Finished at: Fri Jul 14 17:24:31 IST 2017
[INFO] Final Memory: 4M/22M
[INFO] ------------------------------------------------------------------------
[ERROR] Could not find goal '' in plugin org.apache.maven.plugins:maven- install-plugin:2.3.1 among available goals install, install-file, help -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoNotFoundException
make: *** [install-mvn] Error 1
I did not understand the error.Can any of you guide me with this?I would like to know what is being expected and what should the Makefile contain.
Thanks in advance

Maven build - surefire plugin error - File name too long

I was building project as usual with mvn clean install and following error happened:
(File name too long) -> [Help 1]
Full maven output:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:19 min
[INFO] Finished at: 2017-02-23T13:42:19+01:00
[INFO] Final Memory: 67M/544M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project union-sme-webapp: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed: java.lang.RuntimeException: org.apache.maven.surefire.report.ReporterException: When writing report: /home/gondy/projects/xxxxxxx/xxxxxxxxx/webapp/target/surefire-reports/TEST-xx.xxxxx.xxxx.xxxx.webapp.service.document.generator.statics.arrangements.XxxxxxxxxxXxxxxxxXxxxxxxxxxxxXxxxxxxxXxxxxxxxxXxxx.xml (File name too long) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
I am working on Ubuntu 16.04 LTS. My colleagues are building the same project without any problem, it works even on Jenkins CI. What is the problem here? The filename is 144 chars long, which should be fine, ext has limit of 255 charactes.
The problem is, I have encrypted home directory and Ubuntu allows filename only 143 chars long:
From one of authors of eCryptfs:
Empirically, we have found that character filenames longer than 143 characters start requiring >255 characters to encrypt. So we (as eCryptfs upstream developers) typically recommend you limit your filenames to ~140 characters.
https://unix.stackexchange.com/a/32834/82647
So options basically are:
Make filename shorter by renaming methods and classes
Move your project outside encrypted directory
Remove encryption of your home directory
you can always disable file reporting via pom.xml file or console parameters
mvn clean install -Dsurefire.useFile=false -DredirectTestOutputToFile=false -DdisableXmlReport=true
Test results will be logged to console
Other way (untested by me) would be aggregating report, mentioned here maven surefire reporting plugin configuration

Build failure when running “mvn clean” for the first time while installing

I'm new to Maven and trying to use this for the first time in my project.
I've set the system variables;
JAVA_HOME System Variable
M2_HOME System Variable
%JAVA_HOME%\bin;%M2_HOME%\bin; to System Path
In cmd prompt using "mvn -version" i can see all relevant details.
But when I run "mvn clean”, I get the following error
C:\Users\Naina Mantry>mvn clean
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.105 s
[INFO] Finished at: 2016-02-15T08:00:48+05:30
[INFO] Final Memory: 5M/86M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\Naina
Mantry). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
I'm not able to understand, how to fix it. kindly help me please...
Thanks in advance :)
when you run Maven, you need to run it from your proyect directory, where you have your workspace. You need to have a pom.xml file on that Directory.
For example:
C:\Users\Naina Mantry\workspace\proyect
and on that directory you run mvn clean
You seem to be executing mvn clean from a wrong directory. Make sure there is a relevant pom.xml. Maven by default refers to the current working directory. Alternately, you can use -f option to specify a pom.xml located in a different directory.

Resources