Allure Report - Environment not displaying Environment.properties/environment.xml - allure

Trying to set up the environment table in the Allure report, tried to create environment.properties and the environment.xml, but its not generating the environment field. I see in the environment.json file, its empty.
Any idea?
Thanks.
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-allure-environment</id>
<phase>validate </phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/allure-results</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>environment.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

Why don't create the environment.properties from the code during the test?

Related

Is there a way to call React app in a Sring Boot (JSP file) and package them together

I have tried multiple combinations with frontend-maven-plugin but getting
GET http://localhost:8081/demo/static/js/2.8d94841d.chunk.js net::ERR_ABORTED 404 this type of error on a View (JSP) where react page is included. I'm assuming it's due to an installation or page linking error while packaging.
my POM file snippet
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.7.6</version>
<configuration>
<workingDirectory>${frontend-src-dir}</workingDirectory>
<installDirectory>${project.build.directory}</installDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v14.17.0</nodeVersion>
<npmVersion>6.14.13</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<configuration>
<target>
<copy todir="target/Studio/resources/react">
<fileset dir="${project.basedir}/react/demo/build"/>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
path to my react app - {frontend-src-dir}
JSP snippet with react app react app-
<jsp:include page="HeaderPage.jsp">
<jsp:param name="title" value="" />
</jsp:include>
<%#include file="/resources/react/index.html"%>
<jsp:include page="FooterPage.jsp">
<jsp:param name="title" value="" />
</jsp:include>
Project structure
Project structure image

Wildfly-Swarm enable debug

I've managed to convert my "war" application to a hollow jar.
My biggest issue is that even after following the documentation, still cannot enable debug mode (my desired port is 8784)
I am pretty sure that I am missing something but ... what?
<plugin>
<groupId>org.wildfly.swarm</groupId>
<artifactId>wildfly-swarm-plugin</artifactId>
<version>${wildfly-swarm.version}</version>
<executions>
<execution>
<id>package</id>
<goals>
<goal>package</goal>
</goals>
<configuration>
<hollow>true</hollow>
<properties>
<swarm.debug.port>8784</swarm.debug.port>
<debug.port>8784</debug.port>
<swarm.debug.bootstrap>true</swarm.debug.bootstrap>
<java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
</properties>
</configuration>
</execution>
</executions>
</plugin>
The swarm.sebug.port property is only relevant when starting the application via the Swarm Maven plugin, or when using the Swarm Arquillian adapter. When starting the application using java -jar myapp-swarm.jar, you need to use the standard Java way of enabling remote debugging, i.e. something like java -Xdebug -agentlib:jdwp=transport=dt_socket,address=8784,server=y,suspend=n -jar myapp-swarm.jar.
You may want to look into:
https://issues.jboss.org/browse/THORN-1321
or
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206848015-Breakpoints-not-working-when-debugging-simple-Java-EE-app-on-wildfly?page=1#community_comment_360000176459
The first link is the relevant one. I am including the second one just for further information if you are using IntelliJ for IDE.
Briefly, here is my pom configuration:
<plugin>
<groupId>org.wildfly.swarm</groupId>
<artifactId>wildfly-swarm-plugin</artifactId>
<version>${version.wildfly.swarm}</version>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
<configuration>
<debugPort>5005</debugPort>
<properties>
<swarm.debug.port>5005</swarm.debug.port>
</properties>
</configuration>
</plugin>
After starting the application with the mvn swarm plugin, I am connecting with a remote debugger.
Good luck!
Edit (2019.05.31):
My current setup for debugging in the pom.xml is the following:
<plugin>
<groupId>org.wildfly.swarm</groupId>
<artifactId>wildfly-swarm-plugin</artifactId>
<version>${version.wildfly.swarm}</version>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmArguments>
<jvmArgument>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</jvmArgument>
</jvmArguments>
</configuration>
</plugin>

How can I create multiple shared libraries with maven nar plugin?

How can I create multiple shared libraries with maven nar plugin? Here is a snippet from my pom.xml:
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<version>3.5.1</version>
<extensions>true</extensions>
<executions>
<execution>
<id>compile-C-shared-lib</id>
<phase>compile</phase>
<goals>
<goal>nar-compile</goal>
</goals>
</execution>
<execution>
<id>generate_c_header_from_java</id>
<phase>generate-sources</phase>
<goals>
<goal>nar-javah</goal>
</goals>
</execution>
</executions>
<configuration>
<libraries>
<library>
</library>
</libraries>
</configuration>
</plugin>
I can create a shared library with this pom. But I want to build two libraries. From pack of source files. How can I do this?

Pass command line Params in mvn exec:exec

I am amazed that what should have been a very easy job is turning into a very annoying task for me. All i need is to pass few command line parameters to my maven exec:exec plugin. unfortunately hours of googling has not helped at all.
Here is my plugin
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath />
<argument>-javaagent:${settings.localRepository}/org/springframework/spring-instrument/${spring.version}/spring-instrument-${spring.version}.jar</argument>
<argument>-Xmx256m</argument>
<argument>com.myPackage.Myclass</argument>
</arguments>
</configuration>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
Now from the command prompt i am typing in:
mvn exec:exec -Dexec.args=-Dmy.property=myProperty
I also tried:
mvn exec:exec -Dexec.arguments=-Dmy.property=myProperty
And many other things. However nothing seems to be working. I know that exec:exec runs in a separate VM but as per the documentation -Dexec.args should work for me. Can someone please suggest where i am going wrong?
Two ways to pass command line arguments into mvn:exec:
Method 1, on the command line:
mvn exec:java -Dexec.mainClass="com.myPackage.myClass" -Dexec.args="command line arguments"
Method 2, in the maven POM file:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>com.myPackage.myClass</mainClass>
<commandlineArgs>command line arguments</commandlineArgs>
</configuration>
</plugin>
</plugins>
</build>
Then on the command line all you have to do is run:
mvn exec:java
Good luck.
I was able to get JVM args working for exec:exec using the following after reading this article:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-Dhttp.proxyHost=myproxy.example.com</argument>
<argument>-Dhttp.proxyPort=8080</argument>
<argument>-classpath</argument>
<classpath />
<argument>com.example.Main</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
why not use system property?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>bobo.Abc</mainClass>
<arguments>
<argument>argument1</argument>
</arguments>
<systemProperties>
<systemProperty>
<key>jvmProperty1</key>
<value>dev</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
If you want to pass command line arguments to Java VM use <commandlineArgs> tag instead of <arguments>. Maven Exec Plugin
Cheers
I use the following command line setting to pass arguements to my Main-Class with the exceution plugin.
mvn clean install -Dexec.arguments="arg0"
I don't think the selected answer solves the problem. Here is my somewhat hacky solution that works:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath />
<argument>-Xmx256m</argument>
<argument>com.myPackage.Myclass</argument>
<argument>${myProperty1}</argument> <!-- variable args here!!! -->
<argument>${myProperty2}</argument>
</arguments>
</configuration>
<executions>
<execution>
<id>myExecution</id> <!-- defined an id here! -->
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
Now you can simply execute passing the arguments.
mvn exec:exec#myExecution -DmyProperty1=XXX -DmyProperty2=YYY
The problem is that you use -Dexec.args on the command line and it overrides the <arguments> given in pom.xml. You can use either of them, not both.

liquibase using maven with two databases

i have the following structure to run one database from maven:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-plugin</artifactId>
<version>1.9.5.0</version>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<changeLogFile>src/main/resources/db.changelog.xml</changeLogFile>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/charm</url>
<username>***</username>
<password>***</password>
</configuration>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
now i want to run another database in the same server with the name charm2. i tried this:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-plugin</artifactId>
<version>1.9.5.0</version>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<changeLogFile>src/main/resources/db.changelog.xml</changeLogFile>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/charm</url>
<username>***</username>
<password>***</password>
</configuration>
<goals>
<goal>update</goal>
</goals>
</execution>
<execution>
<phase>process-resources</phase>
<configuration>
<changeLogFile>src/main/resources/db.changelog.xml</changeLogFile>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/charm2</url>
<username>***</username>
<password>***</password>
</configuration>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
and it does not work. does anyone know how to solve this?
Perhaps you could try giving an <id> to each <execution>. Something like
...
<execution>
<id>charm</id>
<phase>process-resources</phase>
<configuration>
...
</execution>
<execution>
<id>charm2</id>
<phase>process-resources</phase>
<configuration>
...
</execution>
...
If this does not work, you could update your question with the full stacktrace specifying the exact line that maven fails to validate the pom.

Resources