frontend-maven-plugin icon indicating copy to clipboard operation
frontend-maven-plugin copied to clipboard

Can't add arguments when running the npm goal from the command line

Open erex1 opened this issue 2 years ago • 1 comments

I am running the latest version of the plugin (1.12.1) on my windows machine (Windows 10 Pro 21H2).

I have this execution that is working perfectly when i run it from the pom.xml:

...
<execution>
    <id>npm version</id>
    <goals>
        <goal>npm</goal>
    </goals>
    <configuration>
        <workingDirectory>frontend</workingDirectory>
        <installDirectory>./</installDirectory>
        <arguments>version ${project.version}</arguments>
    </configuration>
</execution>
...

But when I try to run the same thing directly from the command line I can't get it to work. The issue seems to be that everything else then the configuration.arguments is set correctly (i.e configuration.workingDirectory and configuration.installDirectory is set correctly). This causes the plugin to always run the "npm install", since "install" is the default value for arguments.

Here is the command I am trying to run from the command line: mvn frontend:npm -Darguments="version 1.2.3" -DworkingDirectory=frontend -DinstallDirectory=./ (I have tried several variations of the "-Darguments=" value in case the issue is with spaces and/or the double quotes, where I just try to run anything else than the npm install command, but I cant get it to work)

Am I missing something here, or is this a bug?

The reason I want to run in from the command line is because i want to run it as a command in completionGoals with the maven-release-plugin (https://maven.apache.org/maven-release/maven-release-plugin/prepare-mojo.html#completionGoals)

erex1 avatar Apr 29 '22 12:04 erex1

I think, your problem might be that the property to pass arguments to npm is not arguments but frontend.npm.arguments (see here).

cboehme avatar May 24 '22 12:05 cboehme