[go: up one dir, main page]

Allow Node.js download URL to be configurable

The Antora plugin will download Node.js on demand. Corporate policies may stipulate that this download has to happen from a designated server rather than the default one. The plugin should provide a way to customization this URL. (The default is https://nodejs.org/dist/).

One approach is to leverage Maven's plugin management to allow the frontend-maven-plugin to be configured. In order to target the install-node-and-npm goal, this plugin would look for an execution for the specific goal qualified with -antora. For example, install-node-and-npm-antora. Here's how that would look in the POM:

<pluginManagement>
  <plugins>
    <plugin>
      <groupId>com.github.eirslett</groupId>
      <artifactId>frontend-maven-plugin</artifactId>
      <executions>
        <execution>
          <id>install-node-and-npm-antora</id>
          <configuration>
            <nodeDownloadRoot>https://download.example.org/nodejs/dist/</nodeDownloadRoot>
            <npmVersion>10.5.1</npmVersion>
            <serverId>download-server</serverId>
          </configuration>
        </execution>
      </executions>
    </plugin>
  </plugins>
</pluginManagement>

These parameters would be set before any parameters that are passed through from the Antora plugin.

(Several of these parameters, such as nodeDownloadRoot, can already be set using a user property).

The benefit of this approach is that the user has direct access to the configuration parameters for the frontend-maven-plugin, specifically for the install-node-and-npm goal. However, that's also a drawback. We further expose the use of this plugin under the covers and perhaps break existing setups if we decide to move away from it.

The alternate strategy is to add the following parameters to this plugin:

  • nodeDownloadRoot (inherit property mapping from frontend-maven-plugin)
  • npmVersion (inherit property mapping from frontend-maven-plugin)
  • npmDownloadRoot (inherit property mapping from frontend-maven-plugin)
  • downloadServerId (which will map to serverId parameter of frontend-maven-plugin)

The values of these parameters will be passed through to the install-node-and-npm goal of the frontend-maven-plugin.

It's important to keep in mind that the focus of this change is to allow the user to specify the download URL for Node.js (and possibly the download URL and version of npm).

Edited by Dan Allen