在vue项目下新建pom.xml
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<skip>${skipDeploy}</skip>
</configuration>
<executions>
<!--1. 执行npm install-->
<!--如果node_modules安装过了,将第一步执行npm install注销(建议自己用命令安装好node_modules)-->
<!-- <execution>-->
<!-- <id>exec-npm-install</id>-->
<!-- <phase>generate-resources</phase>-->
<!-- <goals>-->
<!-- <goal>exec</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <executable>npm</executable>-->
<!-- <arguments>-->
<!-- <argument>install</argument>-->
<!-- </arguments>-->
<!-- <workingDirectory>${basedir}</workingDirectory>--> <!--你的项目目录-->
<!-- </configuration>-->
<!-- </execution>-->
<!--2. 执行npm build-->
<execution>
<id>exec-npm-run-build</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>build</argument>
</arguments>
<workingDirectory>${basedir}</workingDirectory><!--你的项目目录-->
</configuration>
</execution>
<!--3. dist自动复制到spring boot的resources目录-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
<executions>
<execution>
<id>copy-spring-boot-webapp</id>
<phase>initialize</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>utf-8</encoding>
<!--将dist复制到springboot resources/static目录下-->
<outputDirectory>${project.parent.basedir}/component/iprobemgr/src/main/resources/static</outputDirectory>
<resources>
<resource>
<directory>${basedir}/dist</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</executions>
</plugin>
</plugins>
</build>
新建好后,选中pom右击add到maven,然后直接package或者install即可。