什么是环境变量“locktt”?

What is environment variable `locktt`?

我正在尝试使用 Maven 构建 project

完全如 README.adoc 文件中所述(来自 PowerShell 的命令 mvn clean install -DskipTests -DskipITs)。

我收到以下错误:

[ERROR] System variable locktt undefined [ERROR] npm ERR! code ELIFECYCLE [ERROR] npm ERR! errno 1 [ERROR] npm ERR! @ env: SET "locktt" [ERROR] npm ERR! Exit status 1 [ERROR] npm ERR! [ERROR] npm ERR! Failed at the @ env script. [ERROR] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

我在网上进行了快速搜索,但找不到有关此 locktt 环境变量的任何信息。询问您是否需要有关我的系统的更多详细信息。

它在您的 pom 行 73 中。Maven 尝试构建它,但不知道它是什么。

我们找到了 windows 用例并为此打开了一个 JIRA

正在被 https://issues.jboss.org/browse/BXMSPROD-597 修复 最优先问题

问题是由以下frontend-maven-plugin的执行引起的:

<plugin>
  <groupId>com.github.eirslett</groupId>
  <artifactId>frontend-maven-plugin</artifactId>
  <executions>
    <execution>
      <id>lock-treatment-tool execution</id>
      <phase>compile</phase>
      <goals>
        <goal>npm</goal>
      </goals>
      <configuration>
        <arguments>run env -- locktt</arguments>
      </configuration>
    </execution>
  </executions>
</plugin>

This 运行s npm run env -- locktt,这是对 运行 软件包可执行文件的黑客攻击,无需在 package.json 中添加脚本且无需使用 npx

The env script is a special built-in command that can be used to list environment variables that will be available to the script at runtime.

然而,npm 的 env 脚本实际执行的命令取决于平台。对于 linux,它是 env and for Windows it's SET。 Linux 的 env 允许最后一个参数是将在修改后的环境中执行的命令。这使得 npm run env -- locktt 可以作为执行 locktt(在 linux 上)的 hack。

在 Windows 上失败,因为 SET 以不同的方式处理参数。 SET locktt 表示:显示以 "locktt" 开头的变量,这不出所料地失败了:

[ERROR] System variable locktt undefined