Open peterkronenberg opened 2 years ago
It might be up-to-date on your machine, but what about you CI or other developers? Or for updating packages after switching branches?
Are there any options that I can specify on the Maven command line for allowing me to skip certain steps?
It's documented in the README.
I know this is a year old now, but maybe it will still help someone.
It may depend on your use, I'm not sure, but I was able to use the <skip>
configuration item to skip the executions that I didn't want/need:
<configuration>
<skip>true</skip>
</configuration>
So in my case I have 3 goals: install-node-and-npm
, npm-install
, and scss-compile
, like this:
<executions>
<execution>
<id>install-node-and-npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
</execution>
<execution>
<id>npm-install</id>
<goals>
<goal>npm</goal>
</goals>
</execution>
<execution>
<id>scss-compile</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run scss</arguments>
</configuration>
</execution>
</executions>
The scss is to customize Bootstrap. But every time you change the scss, it requires you to run maven install, which runs all the goals. Well, I figured the first two goals probably only need to be run once since they are just to install node and npm. I just need to compile scss every time. So I added skips for the first two and it seems to work without issues.
And with the skips it looks like this:
<executions>
<execution>
<id>install-node-and-npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
<execution>
<id>npm-install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
<execution>
<id>scss-compile</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run scss</arguments>
</configuration>
</execution>
</executions>
Without the skips, the first goal actually recognizes that node is already installed, so that is automatically skipped, but the second goal still executes every time. Compiling scss still takes a sec but the install process is a bit smoother this way.
I'd like to skip onli install execution but i would keep executing npm build step. Is there any way to do it with command-line arguments?
The only one i found is -Dskip.npm
but it skips the whole npm execution (download, install and build). Did i miss something?
Basing on apwhitelaw's response i managed in this ez way:
<skip.npm>false</skip.npm>
<skip.npm.install>${skip.npm}</skip.npm.install>
<executions>
<execution>
<id>install node and npm</id>
<!- ... ->
<configuration>
<skip>${skip.npm.install}</skip>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<!- ... ->
<skip>${skip.npm.install}</skip>
</configuration>
</execution>
<execution>
<id>npm build</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<!- ... ->
<!- no skip needed here, as 'skip.npm' is already managed by the plugin ->
</configuration>
</execution>
</executions>
With this particular configuration:
-Dskip.npm
option is used, no npm operation is executed.-Dskip.npm.install
option is used, only npm build is executed by this plugin.
In your sample project at https://github.com/eirslett/frontend-maven-plugin/blob/master/frontend-maven-plugin/src/it/example%20project/pom.xml, you have a step which does
npm install
. Is that really necessary? My project is usually going to be up-to-date with anything that it needs, right? This should only be necessary if you're doing a fresh install. I'm just wondering if I'm missing something