我正在尝试使用 Maven 设置 Ecipe 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 捆绑和启动应用程序,我该如何实现呢?