在模块化Java应用程序中使用剧作家
我想在我的模块化Java应用程序中使用 playwright 库。
这是我的主要课程:
package group.test;
import com.microsoft.playwright.Browser;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Playwright;
public class App
{
public static void main(String[] args)
{
try (Playwright playwright = Playwright.create())
{
Browser browser = playwright.chromium().launch();
Page page = browser.newPage();
page.navigate("http://playwright.dev");
System.out.println(page.title());
}
}
}
这是相应的 module.info 文件:
module App.module
{
requires playwright;
}
当我尝试使用Maven的 maven-jlink-plugin 尝试构建此项目时,我会收到以下错误:
[INFO] --- maven-jlink-plugin:3.1.0:jlink (default-jlink) @ test ---
[INFO] -> module: driver ( C:\Users\User\.m2\repository\com\microsoft\playwright\driver\1.17.1\driver-1.17.1.jar )
[INFO] -> module: playwright ( C:\Users\User\.m2\repository\com\microsoft\playwright\playwright\1.17.1\playwright-1.17.1.jar )
[INFO] -> module: com.google.gson ( C:\Users\User\.m2\repository\com\google\code\gson\gson\2.8.6\gson-2.8.6.jar )
[INFO] -> module: driver.bundle ( C:\Users\User\.m2\repository\com\microsoft\playwright\driver-bundle\1.17.1\driver-bundle-1.17.1.jar )
[INFO] -> module: App.module ( D:\programming\eclipse-workspace\test\target\classes )
[ERROR]
[ERROR] Error: Module driver.bundle contains package com.microsoft.playwright.impl, module playwright exports package com.microsoft.playwright.impl to driver.bundle
我是Java模块系统的新手 - 显然问题是 driver.bundle 模块(随附playwright?)需要一个模块,该模块会导出一个包装 driver.bundle 已经包含自己。这是可以固定在我身边的东西(作为用户)吗?
I would like to use the Playwright library in my modular Java application.
This is my main class:
package group.test;
import com.microsoft.playwright.Browser;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Playwright;
public class App
{
public static void main(String[] args)
{
try (Playwright playwright = Playwright.create())
{
Browser browser = playwright.chromium().launch();
Page page = browser.newPage();
page.navigate("http://playwright.dev");
System.out.println(page.title());
}
}
}
And this is the corresponding module.info file:
module App.module
{
requires playwright;
}
When I try to build this project using maven's maven-jlink-plugin I get the following error:
[INFO] --- maven-jlink-plugin:3.1.0:jlink (default-jlink) @ test ---
[INFO] -> module: driver ( C:\Users\User\.m2\repository\com\microsoft\playwright\driver\1.17.1\driver-1.17.1.jar )
[INFO] -> module: playwright ( C:\Users\User\.m2\repository\com\microsoft\playwright\playwright\1.17.1\playwright-1.17.1.jar )
[INFO] -> module: com.google.gson ( C:\Users\User\.m2\repository\com\google\code\gson\gson\2.8.6\gson-2.8.6.jar )
[INFO] -> module: driver.bundle ( C:\Users\User\.m2\repository\com\microsoft\playwright\driver-bundle\1.17.1\driver-bundle-1.17.1.jar )
[INFO] -> module: App.module ( D:\programming\eclipse-workspace\test\target\classes )
[ERROR]
[ERROR] Error: Module driver.bundle contains package com.microsoft.playwright.impl, module playwright exports package com.microsoft.playwright.impl to driver.bundle
I'm new to Java's module system - apparently the problem is that the driver.bundle module (which comes with Playwright?) requires a module which exports a package which driver.bundle already contains itself. Is this something which can be fixed on my side (as a user) and if so, how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论