pom.xml 4.3 KB
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
         xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>com.huaheng.wms</groupId>
    <artifactId>huaheng-wms4</artifactId>
    <version>4.0.1</version>
  </parent>

  <artifactId>ant-design-vue-jeecg</artifactId>
  <packaging>pom</packaging>

  <build>
    <plugins>
      <!-- 删除前端静态资源目录 -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <!-- Vue项目打包自动生成的dist目录 -->
              <directory>${project.parent.basedir}/ant-design-vue-jeecg/dist</directory>
            </fileset>
            <fileset>
              <!-- 前端资源目录,即存放前端包目录 -->
              <directory>${project.parent.basedir}/huaheng-wms-core/src/main/resources/static</directory>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
      <!-- 为项目本地下载/安装Node和NPM 运行npm install命令 -->
      <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <version>1.6</version>
        <configuration>
          <workingDirectory>${project.parent.basedir}/ant-design-vue-jeecg</workingDirectory>
        </configuration>
        <executions>
          <execution>
            <id>install node and npm</id>
            <goals>
              <goal>install-node-and-npm</goal>
            </goals>
            <configuration>
              <nodeVersion>v16.19.0</nodeVersion>
              <npmVersion>8.19.3</npmVersion>
            </configuration>
          </execution>
          <!-- Install all project dependencies -->
          <execution>
            <id>npm install</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <arguments>install</arguments>
            </configuration>
          </execution>
          <!-- Build and minify static files -->
          <execution>
            <id>npm run build</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <configuration>
              <arguments>run build</arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- 复制前端静态资源目录 -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <!-- 避免font文件的二进制文件格式压缩破坏 -->
        <configuration>
          <nonFilteredFileExtensions>
            <nonFilteredFileExtension>woff</nonFilteredFileExtension>
            <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
            <nonFilteredFileExtension>eot</nonFilteredFileExtension>
            <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
            <nonFilteredFileExtension>svg</nonFilteredFileExtension>
          </nonFilteredFileExtensions>
        </configuration>
        <executions>
          <execution>
            <id>copy static</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <!-- 复制前端打包文件到这里 -->
              <outputDirectory>${project.parent.basedir}/huaheng-wms-core/src/main/resources/static</outputDirectory>
              <overwrite>true</overwrite>
              <encoding>UTF-8</encoding>
              <resources>
                <resource>
                  <!-- 从前端打包的dist目录进行指定文件、文件夹内容的复制,具体根据实际前端代码及目录结构进行配置 -->
                  <directory>${project.parent.basedir}/ant-design-vue-jeecg/dist</directory>
                  <includes>
                    <include>**</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>