I have set up maven-surefire-plugin in POM.xml.
Ideally as per the help I got over the internet for using these plugin, my set up should run cucumber Runner files in parallel but they are always getting executed sequentially.
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<fork>true</fork>
<executable>C:\Program Files\Java\jdk1.8.0_201\bin\javac.exe</executable>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<parallel>classes</parallel>
<forkMode>perthread</forkMode>
<threadCount>2</threadCount>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
<includes>
<include>**/*Runner.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Related
I need to set -Duser.language via pom.xml since I need language specific database queries.
When I pass -Duser.language=tr to VM options upon running spring boot application on Intellij, it works. But I need this to be done in pom.xml for profiling.
Below ways are not working. Language is not set.
<profile>
<properties>
<argLine>-Duser.language=tr -Duser.region=TR</argLine>
</properties>
...
</profile>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<verbose>true</verbose>
<fork>true</fork>
<compilerArgs>
<arg>-J-Duser.language=tr_TR</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<argLine>-Duser.language=tr -Duser.region=TR</argLine>
<systemPropertyVariables>
<user.language>tr</user.language>
<user.region>TR</user.region>
</systemPropertyVariables>
</configuration>
</plugin>
Only this is working but I need to run application with mvn spring-boot:run for this to work and that is not an option.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
-Duser.language=tr
</jvmArguments>
</configuration>
...
</plugin>
How can I pass vm arguments via pom.xml?
I have defined my profiles in pom.xml as below:
<profiles>
<profile>
<id>Test123</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<!-- put your configurations here -->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/target/testdemo.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
And we I ran a command mvn test -PTest123, there is no Tests being run as shown as below:
cmd output
However, we I ran with command mvn test, it has ran the test as shown as below:
cmd output
After reviewing the output files I noticed that different versions of the maven-compiler-plugin and maven-surefire-plugin are running per profile. Is this project dependent on a parent pom.xml? Otherwise changing the versions on the plugins to:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<!-- put your configurations here -->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/target/testdemo.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
should fix the problem in case the versioning is not important.
I need a solution to pack all lib-files into the executable jar-file.I use Maven and the Maven plugins javafx-maven-plugin, maven-compiler-plugin and maven-surefire-plugin. I haven't found a solution for my problem based on these plugins yet.
I hope someone can help me. Here are the configurations of the plugins.
<build>
<plugins>
<!-- https://github.com/javafx-maven-plugin/javafx-maven-plugin -->
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.1.4</version>
<configuration>
<mainClass>${exec.mainClass}</mainClass>
<verbose>true</verbose>
<jfxAppOutputDir>${project.basedir}/target/output</jfxAppOutputDir>
<jfxMainAppJarName>${project.name}.jar</jfxMainAppJarName>
<allPermissions>true</allPermissions>
<manifestAttributes>
<Specification-Title>${project.name}</Specification-Title>
<Specification-Version>${project.version}</Specification-Version>
<Specification-Vendor>${project.organization.name}</Specification-Vendor>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Version>${build.number}</Implementation-Version>
<Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id>
<Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
<Implementation-URL>${project.organization.url}</Implementation-URL>
</manifestAttributes>
</configuration>
<executions>
<execution>
<id>create-jfxjar</id>
<phase>package</phase>
<goals>
<goal>build-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArguments>
<bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<skipTests>false</skipTests>
<properties>
<property>
<name>listener</name>
<value>org.sonar.java.jacoco.JUnitListener</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</build>
What you are looking for is called uber-jar or shaded jar. You can use the following maven-plugin:
Maven Shade Plugin
Selecting Contents for Uber JAR
I have plain seleneum ui tests and I want to have nice thucydides reports after how can I do this.
In maven pom.xml I have profile like this:
<profile>
<id>MobileTests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<argLine>-Dfile.encoding=UTF-8</argLine>
<argLine>-Dwebdriver.remote.url=http://192.168.1.5/wd/hub</argLine>
<groups>ru.testgroups.mobile.AllMobile</groups>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>net.thucydides.maven.plugins</groupId>
<artifactId>maven-thucydides-plugin</artifactId>
<version>${thucydides.version}</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
</profile>
It suppose to generate reports, but it does not. How can I get thucydides reports from plain selenium tests
You should add the serenity (or thucydides, if you're using an older version) as a reporting plugin:
<reporting>
<plugins>
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>${serenity.version}</version>
</plugin>
</plugins>
</reporting>
I am working in a project which has over 10 submodules and every one of them has the explicit declaration.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
The parent of these submodules is the same one that contains the submodules. Is there any advantage of doing this over putting it in the parent as
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
....
</plugins>
</pluginManagement>
There is no advantage unless you anticipate changing your mind about this for only some of them.