How to run gulp and spring-boot task: run with maven?

I have two projects, the framework is a Spring boot application, and the other is a web framework framework containing html layouts and a web interface.

I run maven with these goals clean installin order to install the infrastructure in the local repository. Then I want to run maven with the target clean spring-boot:runand profiles prod, devin framework-web in order to run the Spring boot application and run the gulp task in framework-web. But it only launches gulp tasks and does not start the Spring boot application.

This is pom.xml framework-web:

<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>

and this will run the configuration in eclipse:

enter image description here

+4
source share
1

frontend-maven . (transpile/compile/minify/...) Maven. , , "" "", , , Maven .

, "" . "" , -. Gulp Spring, -, .

:

  • frontend-maven-plugin , , serve/watch/...
  • //... , Gulp . Maven. Eclipse, ( ).
  • Spring boot webcontent, , Gulp /JavaScript Spring, - Gulp.
  • - ( Spring), , Maven frontend.
+4

Source: https://habr.com/ru/post/1663241/


All Articles