解决:使用maven打包时dubbo-admin-ui构建失败 (Failed to execute goal com.github.eirslett:frontend-maven-plugin)

在安装dubbo监控中心dubbo-admin 时,使用maven打包项目一直报错

  • 提示 dubbo-admin-ui 构建失败

Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.9.0:npm (npm install) on project dubbo-admin-ui: Failed to run task: ‘npm install’ failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 7
解决:使用maven打包时dubbo-admin-ui构建失败 (Failed to execute goal com.github.eirslett:frontend-maven-plugin)_第1张图片

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.9.0:npm (npm install) on project dubbo-admin-ui: Failed to run task: 'npm install' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 7 (Exit value: 7) -> [Help 1]

大概意思是com.github.eirslett:frontend-maven-plugin:1.9.0这个插件运行失败,实际上打开本地仓库发现这个插件根本下载不下来(忘了留截图了,当时就在仓库目录里发现这个文件下载失败)

然后搜解决方法,只看到了改用阿里的镜像下载那篇,然后试了试发现不行

原文章:https://www.jianshu.com/p/070ce0cf4360

然后我也是尝试了各种方法,最后用手动导入依赖的方法解决了

解决方法:

首先是ui模块构建失败,所以找到ui模块的pom.xml
解决:使用maven打包时dubbo-admin-ui构建失败 (Failed to execute goal com.github.eirslett:frontend-maven-plugin)_第2张图片
找到导入失败的插件com.github.eirslett:frontend-maven-plugin
在这里插入图片描述
手动去远程仓库查找对应的插件

链接:https://repo.maven.apache.org/maven2/com/github/eirslett/frontend-maven-plugin/
解决:使用maven打包时dubbo-admin-ui构建失败 (Failed to execute goal com.github.eirslett:frontend-maven-plugin)_第3张图片
下载所需jar包
解决:使用maven打包时dubbo-admin-ui构建失败 (Failed to execute goal com.github.eirslett:frontend-maven-plugin)_第4张图片
在本地maven仓库中创建1.9.0文件夹,把jar包放进去(版本号)
解决:使用maven打包时dubbo-admin-ui构建失败 (Failed to execute goal com.github.eirslett:frontend-maven-plugin)_第5张图片
更名为刚刚pom.xml所对应的名字 frontend-maven-plugin-1.9.0.jar (对应版本号)
在这里插入图片描述
再前往pom.xml修改对应配置,与刚刚在本地仓库创建的文件夹、文件名一致
解决:使用maven打包时dubbo-admin-ui构建失败 (Failed to execute goal com.github.eirslett:frontend-maven-plugin)_第6张图片
然后把

<goals>
	<goal>npmgoal>
goals>

都删除掉

防止构建时用npm的方式下载插件

完整代码:

<plugin>
                <groupId>com.github.eirslettgroupId>
                <artifactId>frontend-maven-pluginartifactId>
                <version>1.9.0version>
                <executions>
                    <execution>
                        <id>install node and npmid>
                        <configuration>
                            <nodeVersion>v9.11.1nodeVersion>
                        configuration>
                    execution>
                    
                    <execution>
                        <id>npm installid>
                        
                        <phase>generate-resourcesphase>
                        
                        <configuration>
                            <arguments>installarguments>
                        configuration>
                    execution>
                    
                    <execution>
                        <id>npm run buildid>
                        <configuration>
                            <arguments>run buildarguments>
                        configuration>
                    execution>
                executions>
            plugin>

再用maven打包就ok啦

注意官方文档给出 打包最好跳过测试阶段
解决:使用maven打包时dubbo-admin-ui构建失败 (Failed to execute goal com.github.eirslett:frontend-maven-plugin)_第7张图片

mvn clean package -Dmaven.test.skip=true

解决:使用maven打包时dubbo-admin-ui构建失败 (Failed to execute goal com.github.eirslett:frontend-maven-plugin)_第8张图片
大概原理是,maven在远程仓库找不到该依赖,我们用我们找到的依赖放到本地仓库,构建时会先检查本地仓库是否有所需依赖。

之前使用npm下载插件下载不下来
解决:使用maven打包时dubbo-admin-ui构建失败 (Failed to execute goal com.github.eirslett:frontend-maven-plugin)_第9张图片
所以把这些删除,我们手动从远程maven仓库找到依赖下载 即可解决问题


如有疑问或建议欢迎指正!

你可能感兴趣的:(maven,dubbo,github)