由于frontent-maven-plugin,构建maven项目时出现错误

3

我正在尝试构建/编译使用前端Maven插件的Maven项目。然而,在编译项目时,我在IntelliJ IDEA中遇到了这个错误:

Failed to execute goal com.github.eirslett:frontend-maven-plugin:0.0.26:install-node-and-npm (install node and npm) on project PROJECT-NAME: The plugin com.github.eirslett:frontend-maven-plugin:0.0.26 requires Maven version 3.1.0

我已经安装了Maven 3.3.3,现在已将其降级至3.1.1,但是我仍然收到相同的错误信息。

以下是我的POM.xml文件中详细描述插件的部分内容:

 <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>0.0.26</version>

                <configuration>
                    <workingDirectory>src/web</workingDirectory>
                </configuration>

                <executions>
                    <execution>
                        <id>install node and npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <nodeVersion>v0.12.7</nodeVersion>
                            <npmVersion>2.11.3</npmVersion>
                        </configuration>
                    </execution>

                    <execution>
                        <id>npm install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>generate-sources</phase>
                        <configuration>
                            <arguments>install</arguments>
                        </configuration>
                    </execution>

                    <execution>
                        <id>gulp dev build</id>
                        <goals>
                            <goal>gulp</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <arguments>dev-once</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

在终端中运行mvn clean install --debug时,我收到以下错误信息;
   [DEBUG] -- end configuration --
[INFO] Found proxies: []
[INFO] Installing node version v0.12.7
[INFO] Creating temporary directory /Users/folder/Development/BSD/eng-bsd-bigted-server-ice-tea/src/web/node_tmp
[INFO] Downloading Node.js from http://nodejs.org/dist/v0.12.7/node-v0.12.7-darwin-x64.tar.gz to /Users/folder/Development/BSD/eng-bsd-bigted-server-ice-tea/src/web/node_tmp/node.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
Nov 03, 2015 1:41:30 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.NoRouteToHostException) caught when processing request: No route to host
Nov 03, 2015 1:41:30 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request

错误很明显:“插件com.github.eirslett:frontend-maven-plugin:0.0.26需要Maven版本3.1.0”。您正在使用Maven 3.1.0吗? - Tunaki
嗯,我有点以为它可以与3.1.1版本一起使用。 - chinds
如果您在命令行上运行Maven,是否会发生同样的情况?您能否将--debug添加到Maven选项中并发布输出? - Michael Koch
嗨@MichaelKoch,请查看我的编辑后的问题。 - chinds
看起来你有一个网络问题。也许你需要配置代理?你可以在你的主目录下的.m2/settings.XML文件中进行配置。 - Michael Koch
3个回答

0

使用 frontend-maven-plugin 的用户版本为 0.0.22。该版本不需要 Maven 3.1.1,也可以与较低版本的 Maven 兼容。


0

对于较新版本(我使用的是20.04)的IntelliJ,可以在Maven设置中启用使用插件注册表选项:

  1. 单击文件 -> 设置
  2. 展开构建、执行、部署 -> 构建工具 -> Maven
  3. 勾选使用插件注册表
  4. 单击应用确定

我认为Eclipse和其他IDE也应该类似。


0

如果有人遇到版本1.9.1的问题,可以尝试升级到版本1.12.1。这对我来说解决了问题。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接