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

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

Related

Maven plugin removed is still usable

I added to my maven project the a PMD and checkstyle plugins. And when I run them the work perfectly. But when I remove them from the pom.xml I can still run mvn checkstyle:checkstyle or mvn pmd:pmd even though I removed them. Also after removing them I ran mvn clean install. ANy idea of what could happen ?
The commands you execute are plugin goals (plugin:goal) and unlike "mvn install" not a phase.
you can run almost any plugin on a project if maven can find it. The apache maven plugins allow that shortcut notation (pmd:pmd) since maven will try to resolve them in the apache namespace.
Plugins from other sources would need to be run with their full name, for example:
org.codehaus.mojo:versions-maven-plugin:2.5:display-dependency-updates
The plugin itself decides if it can run a goal on its own or if it requires a running reactor and only works within the maven life-cycle (usually because it depends on outputs from other phases)
So in your case: mvn install should not run the pmd plugin anymore if its not in the pom - and install is a phase. mvn pmd:pmd will run it directly with its default config - since pmd:pmd is a plugin goal.
The default plugins per packaging and phase are documented here. These may run if in the pom or not (depending on whats in the project).

How to generate maven artifact with jenkins build number

I'm trying associate maven artifacts name with build number.
ex: sample.1.0.0-snapshot.ear into sample.1.0.0-snapshot.buildnumber.ear
I have tried maven-buildnumber plugin but still no luck.
could anyone help me to do this.
You can use the Versions Maven plugin by executing following command before any other maven targets after clean.
mvn versions:set -DnewVersion=sample.1.0.0-snapshot.$BUILD_NUMBER

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.

Passing a different version number for jacoco maven plugin through jenkins goals and options

I would like to pass a different version number of jacoco maven plugin in jenkins through goals and options for that project as the default version provided by the jenkins is not compatible. Can you please specify the command line that i can use in jenkins.
My current command line goals and options is :
clean org.jacoco:jacoco-maven-plugin:prepare-agent -U install deploy -Dcatalina.home=$WORKSPACE -DskipITs
btw i dont want to change my pom for each project as i have many projects with different poms which are using the default version number.
Regards
Sun

Is there a way to invoke a goal of a particular version of a Maven plugin?

I would like to invoke a goal of a particular version in a Maven plugin from the command line.
How can this be achieved?
I'm looking for something along the lines of:
mvn org.foo:my-plugin:1.2.3-SNAPSHOT:do-something
Your first guess is correct. The scheme for such a command is
mvn groupid:artifactid:version:goal
Example:
mvn org.apache.maven.plugins:maven-compiler-plugin:3.0:compile

Resources