umi是阿里的一個 前端框架,maven想要打包umi框架,必須要用到一個maven插件frontend-maven-plugin。但是不知道爲什麼在我的本地指定outputPath輸出路徑時並沒有生效。還是輸出到umi的默認打包路徑/dist
build --outputPath ${project.build.outputDirectory}/META-INF/resources
maven配置如下:👇👇👇
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.8.0</version>
<configuration>
<npmRegistryURL>https://registry.npm.taobao.org</npmRegistryURL>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<id>install node and yarn</id>
<goals>
<goal>install-node-and-yarn</goal>
</goals>
<configuration>
<nodeVersion>v10.16.2</nodeVersion>
<yarnVersion>v1.17.3</yarnVersion>
<nodeDownloadRoot>https://npm.taobao.org/dist/</nodeDownloadRoot>
<yarnDownloadRoot>https://npm.taobao.org/mirrors/yarn/</yarnDownloadRoot>
</configuration>
</execution>
<execution>
<phase>generate-sources</phase>
<id>yarn install</id>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<phase>generate-sources</phase>
<id>yarn build</id>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>build --outputPath ${project.build.outputDirectory}/META-INF/resources</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
</plugins>
</build>
爲了解決這個問題,我採用了一種折中的方法,在umi的配置文件.umirc.ts中去指定outputPath的輸出路徑。最終終於實現了maven統一打包umi頁面。
outputPath: "./src/main/resources"