与 Maven 构建一起使用时,如何阻止 Gulp 监视更改?

How to stop Gulp from watching for changes when used with with maven build?

我正在使用 gulp 和 frontend-maven-plugin。我在 gulp 中定义的所有任务都在工作。只有一个大问题。在 gulp 任务执行后,cmd 在无限循环中等待,或者更确切地说 GULP 在我使用 Browserify 时监视文件的变化。

我希望 gulp 在我的任务执行后停止监视,让 Maven 的其余子项目执行它们的任务。

我的项目是一个由maven 管理的AEM 项目。 这是 POM 文件的片段

    <groupId>com.github.eirslett</groupId>
    <artifactId>frontend-maven-plugin</artifactId>
    <!-- NB! Set <version> to the latest released version of frontend-maven-plugin, 
      like in README.md -->
    <version>1.6</version>
    <executions>
      <execution>
        <id>install node and npm</id>
        <goals>
          <goal>install-node-and-npm</goal>
        </goals>
        <configuration>
          <nodeVersion>v6.10.0</nodeVersion>
          <npmVersion>1.4.21</npmVersion>
        </configuration>
      </execution>
      <execution>
        <id>npm install</id>
        <goals>
          <goal>npm</goal>
        </goals>
        <!-- Optional configuration which provides for running any npm 
          command -->
        <configuration>
          <arguments>install</arguments>
        </configuration>
      </execution>
      <execution>
        <id>gulp build</id>
        <goals>
          <goal>gulp</goal>
        </goals>
        <configuration>
          <arguments>aemBuild</arguments>
        </configuration>
      </execution>

gulp.task('aemBuild',gulp.series('clean','browserify','copyToAEM','endGulp'));

Gulp通常在所有任务完成后结束。我发现在我的 browserify 任务中添加了一个 watchify 任务,这导致了无限等待。

所以删除 maven 构建的 watchify 解决了这个问题。