"mvn allure:serve" generates report to an temp folder - allure

I was going through the io.qameta.allure documentation and saw this option to generate allure report using "mvn allure:serve"
mvn allure:serve
The report will be generated into a temp folder. The web server with results will start. You can additionally configure the server timeout
regarding the below lines, can we modify in the configuration to generate reports under the particulate folder instead of the temp folder?
do anyone have information about it using this command only?

You can do it by defining a configuration > reportDirectory for allure-maven in your pom.xml file.
Example: in a java/selenium/testng project, here is the reporting section of pom.xml file:
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.10.0</version>
<configuration>
<reportVersion>${allure.version}</reportVersion>
<reportDirectory>allure-report/</reportDirectory>
</configuration>
</plugin>
</plugins>
</reporting>

In order to generate allure reports you need to use: mvn allure:report.
To specify the path of the report generated use the allure maven plugin and in the pom.xml file use this:
<configuration>
<reportVersion>2.14.0</reportVersion>
<resultsDirectory>*allure result path*</resultsDirectory>
<reportDirectory>*allure report path*</reportDirectory>
</configuration>
The following command: mvn allure:serve always uses a temp folder on your device and I haven't seen anywhere in their documentation the ability of defining the path when using the serve command.

Related

When I Eclipse project to maven, Why can't I export a .jar without "Fat Jar Export: Could not find class-path for ...target/test-classes

I had a working Eclipse project for which I could export a .jar file with no problems.
I then did a 'configure/convert to maven'. Now, when I try to export the .jar file I get the error message:
Fat Jar Export: Could not find class-path entry for 'Users/ward/dropbox/workspaces/newautomation/workspace/automation/target/test-classes'.
Although it does write the .jar file, the .jar file does not work properly.
Any help?
ward
As stated in my question, I had a project running in Eclipse and could successfully 'export a runnable jar' using Eclipse. That allowed me to distribute my project as a self contained '.jar' and run it on other systems with a simple:
java -jar project.jar
I am using Eclipse 4.3.0.
I decided I wanted to covert the project to a 'maven project' and did so using eclipse 'project/configure/convert to maven'.
I then found that my old mechanism for creating a .jar no longer worked.
Casting about the internet I finally found the information I needed. The first bit of information was that I needed to create what was called a 'Fat Jar'. When using maven, one creates a 'Fat Jar' by running maven, NOT using the export function in Eclipse. To create a 'Fat Jar', one needs to click on 'Project/Run As' and select 'maven build'. That will get you to a screen where you specify 'Goals'. Ultimately, for me, the goals were "compile assembly:single".
Doing this for the first time will result in warnings and errors. The most important error is:
Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single
This is because the 'pom.xml' file created by the 'convert' process is incomplete. After several frustrating hours, here is what I finally made work. Again, to create the 'Fat Jar', I do:
project/Run As/Maven build
with goals: compile assembly:single
My 'pom.xml' is:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>example</groupId>
<artifactId>example</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>HelloWorld</name>
<description>Hello World Example</description>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifest>
<mainClass>example.HelloWorld</mainClass>
</manifest>
</archive>
<finalName>helloWorld</finalName>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
</project>
Final notes:
The section concerning 'UTF-8' is not strictly needed, it just gets rid of an annoying warning.
There may be other 'unneeded' lines in the 'pom.xml'.
The 'compile' may be unnecessary but I found that when editing the pom.xml file I often got rid of Eclipse syntax type errors by running 'compile' and so I just do it as a matter of course now.

How to enable usage of Flight Recorder in Surefire plugin

I have added below properties in pom.xml for surefire plugin but its still filing with below error
<argLine>-XX:MaxPermSize=512m</argLine>
<argLine>-XX:+UnlockCommercialFeatures</argLine>
<argLine>-XX:+FlightRecorder</argLine>
Error: To use Flight Record first Unlock UnlockCommercialFeatures.
Any suggesting with sample pom.xml configurtion
My observation is when I run Maven build this feature is enabled for main thread but not enabled for the fork thread created by surefire pluin
You cannot use argLine repeatedly. You need to use something along the lines of
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>#{argLine} -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=duration=1000s,filename=surefire.jfr</argLine>
</configuration>
</plugin>
instead. A similar setup works for failsafe.

XL-deploy specification - what does this security spec do?

Using Maven, XL-deploy and Deployit, I want to focus extra on security on the intranet.
In examples I see the following maven, xl-deploy scripts. I have marked it with **** start ... till ... **** end.
What does it accomplish? Security for intranet and/or internet? I have been scanning the documentation for a while.
<build>
<plugins>
<plugin>
<groupId>com.xebialabs.xldeploy</groupId>
<artifactId>xldeploy-maven-plugin</artifactId>
<version>5.1.0</version>
<extensions>true</extensions>
<executions>
...
</executions>
<configuration>
<username>user-xyz</username>
<password>password-xyz</password>
<serverAddress>server-address</serverAddress>
<environmentId>Environments/app-1</environmentId>
<deployables>
************ start
<deployable>
<name>AD-role1</name>
<type>AD.AddRol</type>
<rol>role1,role2</rol>
</deployable>
************ end
Do you also have a document reference?
The XML code here instructs Maven to build a Deployment Archive for XL Deploy. The marked code is one element of the package, a deployable object of type AD.AddRol, to be deployed, I presume, to an AD server to create a role named AD-role-1, or perhaps roles named role1 and role2. This appears to be a custom extension to the XL Deploy product, so the deployment details must be inferred. See https://docs.xebialabs.com/xldeploy-maven-plugin/6.0.x/ for the plugin documentation. See https://docs.xebialabs.com/xl-deploy/ for general information about XL Deploy's model-based deployment type system.

Unable to invoke SureFire plugin to run a Java Test

I have created a Java test (i can convert it to Junit as well if required). I want it to invoke when the project build. I added the dependency in the Pom.xml but on building the project, the test is not triggered. I think the Surefire plugin is not invoked in the first place because i can not see any reports in the target folder.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<includes>
<include>com.configtests/ConfigTests.java</include>
</includes>
</configuration>
</plugin>
Generally, you have this kind of structure:
Module
-- src
-- main
-- java
-- com.module
-- (classes)
-- test
-- java
-- com.module
-- (test classes)
-- pom.xml
Then the plugin syntax looks like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<includes>
<include>*</include>
</includes>
</configuration>
</plugin>
I assume you want to have ConfigTests.java under the package you have named com.configtests in the test directory. Should suffice to just do:
<include>ConfigTests.java</include>
No reason to declare the package prepended. It should find the class properly so long as you have the pom.xml at the top-level and the class under a folder in the same directory accordingly (in the test folder!)
EDIT:
Also, to run the tests as part of your build it should be running the tests auto-magically with: mvn clean install or, you can run the tests isolated like mvn test. Output in the console will indicate if the tests were run or not.

AppEngine Maven Plugin jarSplittingExcludes

I'm trying to include the stanford-corenlp library into my AppEngine application, but am running into "JAR too big" errors when uploading:
com.google.appengine.tools.admin.LocalIOException: Jar.../stanford-corenlp-3.3.0-models.jar is too large. Consider using --enable_jar_splitting.
Unable to update app: Jar /tmp/appcfg4516706702870427847.tmp/WEB-INF/lib/stanford-corenlp-3.3.0-models.jar is too large. Consider using --enable_jar_splitting.
As suggested, I tried the enable_jar_splitting option, but some individuals files were too large and those can't be split. Looking through the plugin docs I found:
jarSplittingExcludes
User property: appengine.jarSplittingExcludes
When --enable-jar-splitting is set, files that match the list of comma
separated SUFFIXES will be excluded from all jars.
So I tried to exclude some of the large files that I'm not using with this pom.xml:
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.target.version}</version>
<configuration>
<enableJarSplitting>true</enableJarSplitting>
<jarSplittingExcludes>englishRNN.ser.gz</jarSplittingExcludes>
</configuration>
</plugin>
However, now when I run
mvn appengine:update
I get:
[INFO] Updating Google App Engine Application
Bad argument: Unknown option: --jar_splitting_excludes
usage: AppCfg [options] <action> [<app-dir>] [<argument>]
...
options:
....
--enable_jar_splitting
Split large jar files (> 10M) into smaller fragments.
--jar_splitting_excludes=SUFFIXES
When --enable-jar-splitting is set, files that match
the list of comma separated SUFFIXES will be excluded
from all jars.
Any ideas on what I'm doing wrong?
Turns out it was a bug. Should be fixed in 1.9.7. You can clone the development branch for earlier access:
$ git clone https://code.google.com/p/appengine-maven-plugin/
$ cd appengine-maven-plugin
$ mvn install
and change in you pom the plugin version to 1.9.7-SNAPSHOT (keep the other artifacts the same, change only for the plugin)

Resources