I am trying to set up an Eclipe MicroProfile Application with Maven. I generated the archive with the MicroProfile Starter at start.microprofile.io, which generates the following pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>de.javahippie.playground</groupId>
<artifactId>config_api</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>2.1</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
</build>
<profiles>
<profile>
<id>payara-micro</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>fish.payara.maven.plugins</groupId>
<artifactId>payara-micro-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
<configuration>
<payaraVersion>5.191</payaraVersion>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
I tried to start the application from Maven, as stated by the documentation: mvn package payara-micro:start
, and Payara does not seem to find my packaged WAR file:
[2019-04-07T10:21:56.358+0200] [] [INFORMATION] [] [PayaraMicro] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1554625316358] [levelValue: 800] Deployed 0 archive(s)
However, if I run this command from my projects' target
folder, everything works as expected: java -jar config_api-microbundle.jar
.
I would prefer bundling and starting the application with maven a lot, how can I achieve this?
Generated Payara Micro application from https://start.microprofile.io can be started using bundled Payara Micro uber jar with the following instructions :
The generation of the executable jar file can be performed by issuing the following command
mvn clean package
This will create an executable jar file demo-microbundle.jar within the target maven folder. This can be started by executing the following command
java -jar target/demo-microbundle.jar
To launch the test page, open your browser at the following URL
And If you want to start Payara Micro instance from war, You may set deployWar
property value to true
:
<plugin>
<groupId>fish.payara.maven.plugins</groupId>
<artifactId>payara-micro-maven-plugin</artifactId>
<version>1.0.4</version>
<configuration>
<payaraVersion>5.191</payaraVersion>
<deployWar>true</deployWar>
</configuration>
</plugin>