[英]How to run gulp task and spring-boot:run together with maven?
我有两个项目, 框架是Spring启动应用程序,另一个是框架web ,包含html布局和web ui。
我用这个目标运行maven, clean install
将框架安装到本地存储库中。 然后我想用目标clean spring-boot:run
运行maven clean spring-boot:run
和这个配置文件prod, dev
在framework-web上启动Spring启动应用程序并在framework-web上运行gulp任务。 但它只运行gulp任务,并且不启动spring boot应用程序。
这是framework-web的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.rgh</groupId>
<artifactId>framework-web</artifactId>
<version>0.0.1-releases</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
</parent>
<properties>
<start-class>com.rgh.framework.Application</start-class>
</properties>
<dependencies>
<dependency>
<groupId>com.rgh</groupId>
<artifactId>framework</artifactId>
<version>0.0.1-releases</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>prod</id>
<build>
<finalName>framework-web</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<fork>true</fork>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>dev</id>
<build>
<finalName>framework-web</finalName>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v4.4.7</nodeVersion>
<npmVersion>3.10.5</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
<configuration>
<arguments>install --no-color</arguments>
</configuration>
</execution>
<execution>
<id>gulp build</id>
<goals>
<goal>gulp</goal>
</goals>
<configuration>
<arguments>serve</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
这是在eclipse中运行配置:
你没有正确使用frontend-maven-plugin。 此插件旨在在Maven构建期间构建您的代码(transpile / compile / minify / ...)。 但是,它不适用于“服务”或“监视”等任务,这将使进程永远运行,因为这也意味着您的Maven构建将永远运行。
此外,您并不需要“服务”任务。 当您想要在单独的Web容器中运行前端代码时,“服务”任务非常有用。 但是因为你在Spring引导项目中使用Gulp,它已经拥有自己的web容器,所以你不应该创建自己的。
解决方案:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.