该应用程序是使用 NetBeans Payara Micro 插件创建的 hello world:它只包含一个 index.html 和一个编写“hello world”的主类。
我在 POM 中添加了一个依赖项,以检查是否正确处理了外部库。我不想要一个超级罐子,所以我的 POM 将库放在/lib
文件夹内的/target
文件夹中
我在 NetBeans 中构建应用程序,然后在文件夹中打开一个 shell /target
,部署:
java -jar ../payara-micro-5.183.jar myApp.war --addLibs lib/
服务器启动并部署应用程序,但缺少外部库:
PWC6351: In TLD scanning, the supplied resource file:/C:/Users/LEVALL~1/AppData/Local/Temp/payaramicro-rt8447922723645389161tmp/applications/lib/utils-1.0.jar does not exist
java.io.FileNotFoundException: C:\Users\LEVALL~1\AppData\Local\Temp\payaramicro-rt8447922723645389161tmp\applications\lib\utils-1.0.jar (Le chemin dÆaccÞs spÚcifiÚ est introuvable)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
供参考的POM:
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.clementlevallois</groupId>
<artifactId>qof-back-email</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>qof-back-email</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.javaee>8.0</version.javaee>
<version.payara>5.183</version.payara>
<version.microprofile>2.0.1</version.microprofile>
</properties>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>utils</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>${version.javaee}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>${version.microprofile}</version>
<scope>provided</scope>
<type>pom</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>net.clementlevallois.qof.back.email.Controller</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>