Maven pom configuration to see the errors on netbeans console - maven

I have some problem when I try to run maven on netbeans the netbeans-console write:
Failed to execute goal XXXXXX on project MavenEnterpriseApp-ear: XXX failed (result=1) -> [Help 1]
My question is, existe some configuration on the pom that I can use to see what happend with the plugin without run mvn on console? and if not how can I do that?
Thanks...

You can invoke maven with the -e option to receive a more detailed error message including a stacktrace. This option can be set as the default in NetBeans by selecting
Tools -> Options -> Miscellaneous -> Maven
And adding -e to "Global Execution Options".

Related

Could not find artifact and could not resolve dependencies

I'm working in a maven project which contains many dependencies, i have a dependency from a centralized remote NEXUS repository ,so i should have a specific configuration in my setting.xml..
so When i launch clean install from the maven tab in intellij it displays errors:
ERROR] Failed to execute goal on project calender: Could not resolve
dependencies for project com.orange:calender:war:1.0-SNAPSHOT: Could
not find artifact com.francetelecom.clara.component:security:jar:3.0.0
in central (https://repo.maven.apache.org/maven2) -> [Help 1]
but when i switch to the Terminal tab in intellij the build succeed without errors and when i try to deploy the war within Tomcat it won't.
Tomcat log:
java.lang.NoSuchMethodError:
org.apache.commons.collections.ArrayStack: method (I)V not found
at org.apache.commons.digester.Digester.(Digester.java:150) at
com.francetelecom.clara.security.config.SecurityConfig.parse(SecurityConfig.java:95)
at
com.francetelecom.clara.security.SecurityManager.initialize(SecurityManager.java:114)
at
com.francetelecom.clara.security.SecurityManager.(SecurityManager.java:99)
at
com.francetelecom.clara.security.SecurityManager.getContextInstance(SecurityManager.java:371)
When running maven from maven tab in IntelliJ, you use the settings you find from Alt/Ctrl S -> Build, Execution, Deployment > Build Tools > Maven
When running from terminal in IntelliJ it will use first mvn you find on PATH and use configuration from what you get there. "mvn -version" from terminal will show you your Maven Home when running mvn from terminal

Maven gives this project has disliked artifacts error when using Jung dependency

I have a Java project where I want to make some calls to a Jung library. I added the following lines to the pom.xml
net.sf.jung
jung-algorithms
2.0.1
However when I run "mvn package", I get the following error
[ERROR] Failed to execute goal licensing-maven-plugin:1.
7.5:check (enforce-licensing-oss) on project server-examples: This project
has 3 disliked artifacts. -> [Help 1]
Any insights as to what may be going wrong ?
You have configured the licensing-maven-plugin to complain when you introduce a dependency with certain licenses. You, or whoever wrote your pom. If you read the configuration for that plugin it will tell you what licenses it is configured to like and dislike.

SonarRunner can't find sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources

I am attempting to get Jenkins to run Sonar as a post-build step.
Jenkins runs SonarRunner [1] but this fails with:
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: You must define the following mandatory properties for 'Unknown': sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources
If I run mvn sonar:sonar [2] instead it works fine. It almost sounds like SonarRunner is ignoring pom.xml. How do I get SonarRunner to pick up these properties from Maven?
[1] /Users/builds/.jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Default_Sonar_Runner/bin/sonar-runner -Dsonar.jdbc.url=jdbc:h2:tcp://myServer:1009/sonar -Dsonar.host.url=http://myServer/sonar/ -Dsonar.projectBaseDir=/Users/builds/.jenkins/workspace/myProject
[2] mvn sonar:sonar -Dsonar.jdbc.url=jdbc:h2:tcp://myServer:1009/sonar -Dsonar.host.url=http://myServer/sonar/ -Dsonar.projectBaseDir=/Users/builds/.jenkins/workspace/myProject
UPDATE: Per https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-jenkins/ the desired functionality is now available.
What a nice way to waste an evening...
According to this Sonar Runner is not meant for Maven projects. It turns out you're supposed to look under "Post-Build Actions" (not "Post-Build Steps") and you will find "Sonar". See here for more information.
Method 1:
If you installed a scanner in Jenkins then just add the following
in this location on your job
Post Steps -> Execute SonarQube Scanner -> Analysis properties
sonar.projectKey=myProject1
sonar.sources=.
Method 2:
Another alternative is using the deprecated method which still works fine
Post-build Actions -> SonarQube analysis with Maven
Method 3:
Build -> Goals and options -> "enter the below script"
-Dmaven.test.skip=true install sonar:sonar -Dsonar.forceAnalysis=true -Dsonar.host.url=http://localhost:9000/ -Dsonar.branch=my-branch-1
There is some Maven GAV info data mapped into Jenkins variables, look at this thread: Automatically derive mandatory SonarQube properties from pom file in Jenkins
Try below configuration in sonar-scanner.properties:
sonar.host.url=http://localhost:9000
sonar.projectKey=<your project package>
sonar.projectName=<your project name with absolute path>
sonar.projectVersion=1.0
sonar.sources=src/main/java/
sonar.language=java
sonar.java.binaries=target/classes

Issues in sonar analysis through Maven of php project

I am trying to do sonar analysis through maven of a php project.
I have gone followed all the instruction mentioned on http://docs.codehaus.org/display/SONAR/PHP+Plugin, have done all the necessary set up and changes mentioned.
I am getting following error messages after execution of the command mvn sonar:sonar from project directory.
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (d
efault-cli) on project espritKM: Can not execute Sonar: PHPMD execution failed w
ith returned code '255'. Please check the documentation of PHPMD to know more ab
out this failure. -> [Help 1]
In such case, you should run the analysis in Debug mode (i.e. with "-X") in order to find which exact PHPMD command is launched and then run it manually in a shell to see what's happening.

use Maven to add info from MKS to Sonar

According to to the SCM Activity plugin info from the Sonar Webiste (http://docs.codehaus.org/display/SONAR/SCM+Activity+Plugin), a connection to MKS should be possible. On the Maven site, MKS provider code also exists.
However, when I run mvn sonar:sonar in my command line, I get the error:
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project example-it-jacoco-maven: Can not execute Sonar: Unsupported SCM: [svn:integrity]. Check compatibility at http://docs.codehaus.org/display/SONAR/SCM+Activity+Plugin. Please check the parameter "sonar.scm.url" or the section of Maven pom. -> [Help 1]
Do I need to somehow import the provider (coded into the pom.xml ?) or is there something wrong with my code in the pom:
scm:svn:integrity|myuser#mkssvr1:7001|#/SonarScm/TestCode
Anybody have an idea how to get this to work?
Cheers,
Kristian
I believe that correct URL will look like : scm:integrity|myuser#mkssvr1:7001|#/SonarScm/TestCode

Resources