配置 Maven 项目

本页介绍如何将 JxBrowser 添加到基于 Maven 的项目中。

存储库

为了使用 Maven 获取 JxBrowser JAR 文件,您需要将以下代码添加到 pom.xml 文件的 repositories 部分:

<repository>
  <id>com.teamdev</id>
  <url>https://europe-maven.pkg.dev/jxbrowser/releases</url>
</repository>

指向 https://europe-maven.pkg.dev/jxbrowser/releases Maven 存储库的链接无法在网页浏览器中访问,因为它托管在 Google云端的工件注册表中。

发布的 Maven 存储库在美国地区可用,网址为 https://us-maven.pkg.dev/jxbrowser/releases.

依赖项

跨平台

如果您的项目在 Windows、macOS 和 Linux 上运行,请将以下代码添加到 pom.xml 文件的dependencies 部分:

<dependency>
  <groupId>com.teamdev.jxbrowser</groupId>
  <artifactId>jxbrowser-cross-platform</artifactId>
  <version>7.38.0</version>
  <type>pom</type>
</dependency>

特定平台

如果您只需要特定平台的 JxBrowser JAR 文件,您可以使用如下所述的适当依赖项。

如果您的 Java 应用程序仅在 Windows 和 macOS 平台上运行,并且您不需要 Linux 依赖项,则可以仅包含 Windows 和 macOS 依赖项。

Windows 32位

<dependency>
  <groupId>com.teamdev.jxbrowser</groupId>
  <artifactId>jxbrowser-win32</artifactId>
  <version>7.38.0</version>
</dependency>

Windows 64位

<dependency>
  <groupId>com.teamdev.jxbrowser</groupId>
  <artifactId>jxbrowser-win64</artifactId>
  <version>7.38.0</version>
</dependency>

macOS 64位

<dependency>
  <groupId>com.teamdev.jxbrowser</groupId>
  <artifactId>jxbrowser-mac</artifactId>
  <version>7.38.0</version>
</dependency>

macOS 64位 ARM

<dependency>
  <groupId>com.teamdev.jxbrowser</groupId>
  <artifactId>jxbrowser-mac-arm</artifactId>
  <version>7.38.0</version>
</dependency>

Linux 64位

<dependency>
  <groupId>com.teamdev.jxbrowser</groupId>
  <artifactId>jxbrowser-linux64</artifactId>
  <version>7.38.0</version>
</dependency>

Linux 64位 ARM

<dependency>
  <groupId>com.teamdev.jxbrowser</groupId>
  <artifactId>jxbrowser-linux64-arm</artifactId>
  <version>7.38.0</version>
</dependency>

部件工具箱

如果要在 Java Swing/JavaFX GUI 应用程序中显示网页内容,那么您还需要包含以下依赖项之一:

Swing

<dependency>
  <groupId>com.teamdev.jxbrowser</groupId>
  <artifactId>jxbrowser-swing</artifactId>
  <version>7.38.0</version>
</dependency>

JavaFX

<dependency>
  <groupId>com.teamdev.jxbrowser</groupId>
  <artifactId>jxbrowser-javafx</artifactId>
  <version>7.38.0</version>
</dependency>

SWT

<dependency>
  <groupId>com.teamdev.jxbrowser</groupId>
  <artifactId>jxbrowser-swt</artifactId>
  <version>7.38.0</version>
</dependency>
Go Top