如何将附加参数从maven build传递到npm

如何将附加参数从maven build传递到npm,maven,npm,parameter-passing,npm-scripts,exec-maven-plugin,Maven,Npm,Parameter Passing,Npm Scripts,Exec Maven Plugin,我在连接maven 3.6版、exec maven插件1.6.0版和npm 6.13.4版时遇到了一个问题 我的pom.xml文件中的插件定义如下 <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.6.0</ve

我在连接maven 3.6版、exec maven插件1.6.0版和npm 6.13.4版时遇到了一个问题

我的pom.xml文件中的插件定义如下

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.6.0</version>
        <executions>
          <execution>
            <id>exec-npm-install</id>
            <phase>generate-sources</phase>
            <configuration>
              <executable>npm</executable>
              <workingDirectory>../my-frontend-app</workingDirectory>
              <arguments>
                <argument>run</argument>
                <argument>build</argument>
              </arguments>
            </configuration>
            <goals>
              <goal>exec</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

org.codehaus.mojo
execmaven插件
1.6.0
执行npm安装
生成源
npm
../my frontend应用程序
跑
建造
执行官
感谢这个插件,我能够在maven构建期间运行npm运行构建

我的问题是使用这个插件向我的npm构建传递额外的参数。 我想在maven构建期间将应用程序版本从pom.xml传递到我的前端应用程序


有人能帮我吗?

如果你添加更多参数,例如
arg1
它将运行
npm run build arg2
。你想要的npm命令是什么?一个例子是
…{…,“scripts”:{…,“docker:tag”:“image:latest image:1.6.0”,…},…}…
问题是如何以编程方式从npm脚本的
pom.xml
中读取版本
docker:tag