项目采用maven管理后台编译,前端代码使用gulp编译,如何进行整合开发呢?
与maven整合
采用exec-maven-plugin插件,可以在complie阶段绑定gulp构建
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<!– 初始阶段执行npm install –>
<execution>
<id>exec-npm-install</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<!– 执行gulp构建,在clean阶段,清空webapp目录 –>
<execution>
<id>exec-gulp-clean</id>
<phase>clean</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>gulp</executable>
<arguments>
<argument>clean</argument>
</arguments>
</configuration>
</execution>
<!– 执行gulp构建,在编译阶段,将src/main/websrc目录中的前端代码编译到src/main/webapp –>
<execution>
<id>exec-gulp-default</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>gulp</executable>
<arguments>
<argument>default</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
ps:eclipse可能会提示phase错误,按ctrl+1进行quick fix即可
与eclipse自动编译整合
添加builder
同样,可以适用于NPM/Grunt等构建
你好,我想在eclipse构建gulp自动编译可以实现吗,看了你的文章不甚解,可以来个详细的吗
还是用watch吧,整合并没有提高效率