I have app MyApp which is an Angular app but it has to be wrapped into a .war archive MyApp.war since I have to deploy it to Liberty server. I have exec-maven-plugin set as below with exec goal to run npm install command <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>npm-install</id> <phase>prepare-package</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>npm</executable> <arguments> <argument>install</argument> </arguments> </configuration> </execution> ... With this configuration of exec-maven-plugin, the npm-install execution will run npm install and will ALWAYS install ALL dependencies specified in package.json. I want to omit installing dependencies specified in optionalDependencies section of package.json if an EnvName argument is passed to exec-maven-plugin. QUESTION: How do I make the exem-maven-plugin npm-install execution receive an argument named EnvName and if EnvName is equal to test, execute npm install --include=optional and if EnvName is not equal to test execute npm install --omit=optional? I have tried modifying the exec-maven-plugin configuration like below, and that would execute fine but would not install optional dependencies regardless what I pass as EnvName. <arguments> <argument>install</argument> <argument> <!-- If EnvName is 'test', include optional dependencies --> ${EnvName.equals('test') ? '--include=optional' : '--omit=optional'} </argument> </arguments> Continue reading...