Can somebody explain this Maven command to me? - maven

Can you please explain this command detailedly, please? What is exec? and exec:exec? -Pexperiment? -DconfigFile?
mvn exec:exec -Pexperiment -DconfigFile=src/test/resources/configFile/configFile-demo000.js

Its runnng the exec goal defined by the exec plug-in using the 'experiment' profile. The 'configFile' value is also being defined in the command-line as an system property.

mvn is the Maven Command
exec:exec is a shortcut for the goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (version may differ). This is described here: http://mojo.codehaus.org/exec-maven-plugin/exec-mojo.html.
-Pexperiment is telling maven to use a Build Profile called experiment. Build Profiles are described here: http://maven.apache.org/guides/introduction/introduction-to-profiles.html
-DconfigFile=... is a system property that is being used by maven in the pom file or by a plugin. Maven properties are described here: http://www.sonatype.com/books/mvnref-book/reference/resource-filtering-sect-properties.html. How to configure plugins is described here: http://maven.apache.org/guides/mini/guide-configuring-plugins.html

Related

How to run a single test/simulation with Gatling Maven plugin?

Is it possiblt to run only a single test/simulation with Gatling Maven plugin with comand line arguments? Similar to SBT plugin testOnly.
This is possible with parameter gatling.simulationClass, for example
mvn gatling:test -Dgatling.simulationClass=foo.bar.MySimulation
(Gatling Maven plugin 3.1.1 used)
In general, different parameters can be seen with
mvn gatling:help -Ddetail=true

running maven sonar from unix

I have a mvn project. I want to run it against sonar.
e.g. the following command - mvn org.codehaus.mojo:sonar-maven-plugin:2.0:sonar
Without going in and modifying the application pom file to add sonar plugin, is there another way that I can call the mvn command and reference sonar plugin ?
I don't know how it works, but if you execute it from Jenkins with the Sonar plugin it will work without modifying your pom.xml.

What is the purpose of sonar-maven3-plugin?

I want to analyze a Maven 3 project. I found the following plugins:
org.codehaus.mojo:sonar-maven-plugin:2.0
org.codehaus.sonar:sonar-maven-plugin:3.6.2
org.codehaus.sonar:sonar-maven3-plugin:3.6.2
So I can run Sonar analysis with 3 ways:
mvn org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (or simply mvn sonar:sonar since the package is org.codehaus.mojo)
or
mvn org.codehaus.sonar:sonar-maven-plugin:3.6.2:sonar
or
mvn org.codehaus.sonar:sonar-maven3-plugin:3.6.2:sonar
What is the most appropriate way for me?
Regarding the different groupIDs of the plugins you mentioned, this is explained here:
What is the difference between org.codehaus.mojo:sonar-maven-plugin and org.codehaus.sonar:sonar-maven-plugin?
The documentation is clear about that: you just have to execute mvn sonar:sonar to run your analysis, no need to worry about anything else - SonarQube handles that for you.

maven determine default lifecycle phase for plugin

I'm using a maven plugin and I'm trying to determine that default goal it binds to. Is there a command to run to figure that out?
I was able go into the source and find the #phase annotation, but I would like to be able to figure it out from the command line if possible.
You can use the maven-help-plugin to get such kind of information:
For example for the maven-compiler-plugin:
mvn help:describe -DartifactId=maven-jar-plugin -DgroupId=org.apache.maven.plugins -Ddetail=true -Dgoal=jar

How to list all the goals of a particular maven plugin

How to list all the goals of a particular maven plugin (e.g. I would like to list all the goals for maven-clean-plugin or maven-javadoc-plugin, how do I do that?)
You can use this command to list all goals of a particular maven plugin.
mvn help:describe -DgroupId=org.apache.maven.plugins
-DartifactId=maven-war-plugin
-Ddetail=true`
you could always look here in the documentation?
on linux you could use the bash_completion plugins that are out there for maven. this has been working for me:
https://github.com/juven/maven-bash-completion

Resources