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?