com.github.eirslett:frontend-maven-plugin我的maven项目中有一个.
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>0.0.27</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<phase>generate-resources</phase>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>install</arguments>
<workingDirectory>${basedir}/src/main/webapp</workingDirectory>
</configuration>
</execution>
</executions>
<configuration>
<nodeVersion>v4.2.4</nodeVersion>
<npmVersion>2.7.1</npmVersion>
<nodeDownloadRoot>https://nodejs.org/dist/</nodeDownloadRoot>
<npmDownloadRoot>https://registry.npmjs.org/npm/-/</npmDownloadRoot>
<workingDirectory>${basedir}/src/main/webapp</workingDirectory>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
现在我需要将其迁移到gradle但我无法找到如何做到的示例.成绩迁移工具仅转换依赖项,但不转换插件.有一些例子,我怎样才能使用frontend-maven-plugin的gradle?
您可能找不到关于如何frontend-maven-plugin在 Gradle 中使用 的任何示例,因为它专用于 Maven。但是你可以看看Siouan Frontend Gradle plugin,它是 Gradle 的等效解决方案,并允许(来自官方网站):
将您的前端 NPM/Yarn 构建集成到 Gradle 中。
用法和配置似乎与您的 Maven 配置很接近。在你的build.gradle文件中定义 Node/NPM/Yarn 版本,根据 Gradle 生命周期任务(clean/assemble/check)链接你想要运行的脚本,就是这样。以下是 Gradle 5.4 和 NPM 下的典型用法,摘自文档:
// build.gradle
plugins {
id 'org.siouan.frontend' version '1.1.0'
}
frontend {
nodeVersion = '10.15.3'
// See 'scripts' section in your 'package.json file'
cleanScript = 'run clean'
assembleScript = 'run assemble'
checkScript = 'run check'
}
Run Code Online (Sandbox Code Playgroud)
你会注意到:
frontend-maven-plugin,没有声明/配置来触发 Gradle 的前端构建,因为它已经开箱即用。Node/NPM/Yarn 的下载、安装不需要声明/配置——除了版本号,以及构建任务。只需提供 NPM/Yarn 命令行来清理/组装/检查您的前端。6.2.1. 因此,您的初始配置4.2.4将需要迁移 Node.js。问候
| 归档时间: |
|
| 查看次数: |
5232 次 |
| 最近记录: |