运行 来自 Maven 的 Payara Micro:"Deployed 0 archive(s)"

Running Payara Micro from Maven: "Deployed 0 archive(s)"

我正在尝试使用 Maven 设置 Eclipe MicroProfile 应用程序。我在 start.microprofile.io 使用 MicroProfile Starter 生成了存档,它生成了以下 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>

我试图从 Maven 启动应用程序,如文档所述:mvn package payara-micro:start,但 Payara 似乎没有找到我打包的 WAR 文件:

[2019-04-07T10:21:56.358+0200] [] [INFORMATION] [] [PayaraMicro] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1554625316358] [levelValue: 800] Deployed 0 archive(s)

但是,如果我从项目的 target 文件夹中 运行 此命令,一切都会按预期进行:java -jar config_api-microbundle.jar.

我更喜欢使用 maven 捆绑和启动应用程序,我该如何实现?

https://start.microprofile.io 生成的 Payara Micro 应用程序可以按照以下说明使用捆绑的 Payara Micro uber jar 启动:

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

http://localhost:8080/index.html

并且如果您想从 war 启动 Payara Micro 实例,您可以将 deployWar 属性 值设置为 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>