专栏首页实战docker使用fabric8-maven-plugin插件的错误处理(No plugin found for prefix 'fabric8')

使用fabric8-maven-plugin插件的错误处理(No plugin found for prefix 'fabric8')

版权声明:欢迎转载,请注明出处,谢谢。 https://blog.csdn.net/boling_cavalry/article/details/91132345

使用maven插件fabric8-maven-plugin部署springboot应用到kubernetes时遇到构建失败的问题,错误信息是No plugin found for prefix ‘fabric8’ in the current project,通过修改maven的settings.xml解决问题,在此做个记录:

环境信息

  1. 操作系统:CentOS Linux release 7.6.1810
  2. Kubernetes:1.14.0
  3. Java:1.8.0_191
  4. Maven:3.6.0
  5. fabric8-maven-plugin插件:3.5.37

错误出现

构建部署命令如下:

mvn clean package fabric8:deploy -Pkubernetes

执行上述命令后,构建失败,错误信息如下:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Spring Cloud Kubernetes :: Examples 1.1.0.BUILD-SNAPSHOT:
[INFO] 
[INFO] Spring Cloud Kubernetes :: Examples ................ SKIPPED
[INFO] Spring Cloud Kubernetes :: Examples :: Reload ConfigMap SKIPPED
[INFO] Spring Cloud Kubernetes :: Examples :: Hello World . SKIPPED
[INFO] Spring Cloud Kubernetes :: Examples :: Leader Election SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  59.089 s
[INFO] Finished at: 2019-06-07T19:15:14+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'fabric8' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/root/.m2/repository), spring-snapshots (https://repo.spring.io/libs-snapshot-local), spring-milestones (https://repo.spring.io/libs-milestone-local), spring-releases (https://repo.spring.io/libs-release-local), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

解决问题

  1. 需要修改maven的配置文件settings.xml,完整路径是apache-maven-3.6.0/conf/settings.xml;
  2. 在settings.xml文件内,找到pluginGroups节点,在里面增加两行,修改完成后效果如下:
<pluginGroups>
    <pluginGroup>io.fabric8</pluginGroup>
    <pluginGroup>org.springframework.boot</pluginGroup>
  </pluginGroups>
  1. 修改完毕保存退出;

问题解决:

再次执行mvn clean package fabric8:deploy -Pkubernetes,问题解决,如下:

[INFO] --- fabric8-maven-plugin:3.5.37:deploy (default-cli) @ kubernetes-leader-election-example ---
[INFO] F8: Using Kubernetes at https://192.168.121.128:6443/ in namespace default with manifest /usr/local/work/k8s/spring-cloud-kubernetes-master/spring-cloud-kubernetes-examples/kubernetes-leader-election-example/target/classes/META-INF/fabric8/kubernetes.yml 
[INFO] Using namespace: default
[INFO] Creating a Service from kubernetes.yml namespace default name kubernetes-leader-election-example
[INFO] Created Service: spring-cloud-kubernetes-examples/kubernetes-leader-election-example/target/fabric8/applyJson/default/service-kubernetes-leader-election-example.json
[INFO] Using namespace: default
[INFO] Creating a Deployment from kubernetes.yml namespace default name kubernetes-leader-election-example
[INFO] Created Deployment: spring-cloud-kubernetes-examples/kubernetes-leader-election-example/target/fabric8/applyJson/default/deployment-kubernetes-leader-election-example.json
[INFO] F8: HINT: Use the command `kubectl get pods -w` to watch your pods start up
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Spring Cloud Kubernetes :: Examples 1.1.0.BUILD-SNAPSHOT:
[INFO] 
[INFO] Spring Cloud Kubernetes :: Examples ................ SUCCESS [02:44 min]
[INFO] Spring Cloud Kubernetes :: Examples :: Reload ConfigMap SUCCESS [ 55.511 s]
[INFO] Spring Cloud Kubernetes :: Examples :: Hello World . SUCCESS [ 13.684 s]
[INFO] Spring Cloud Kubernetes :: Examples :: Leader Election SUCCESS [02:07 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  06:04 min
[INFO] Finished at: 2019-06-07T19:28:34+08:00
[INFO] ------------------------------------------------------------------------

查看kubernetes的service,发现部署成功:

[root@maven spring-cloud-kubernetes-examples]# kubectl get services
NAME                                 TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
kubernetes                           ClusterIP   10.96.0.1       <none>        443/TCP          18h
kubernetes-hello-world               NodePort    10.100.204.21   <none>        8080:30134/TCP   5m39s
kubernetes-leader-election-example   NodePort    10.102.68.119   <none>        8080:30642/TCP   3m32s
spring-cloud-reload                  NodePort    10.98.2.101     <none>        8080:31993/TCP   5m53s

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • Docker与Jib(maven插件版)实战

    Java应用如果要运行在docker环境,就要制作包含该应用的docker镜像,Jib就是用来制作此镜像的的工具,有三种使用Jib的方法:

    程序员欣宸
  • maven编译遇到"编码GBK的不可映射字符"警告的处理

    maven用的是win10的字符集,在winndows命令行输入chcp,返回936表示GBK,如下图:

    程序员欣宸
  • ARM架构下的Docker环境,OpenJDK官方没有8版本镜像,如何完美解决?

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 ...

    程序员欣宸
  • Docker与Jib(maven插件版)实战

    Java应用如果要运行在docker环境,就要制作包含该应用的docker镜像,Jib就是用来制作此镜像的的工具,有三种使用Jib的方法:

    程序员欣宸
  • eclipse中建geoserver源码

    概述:本文讲述的是在eclipse中如何构建geoserver源码工程,其中涉及到了jdk,github,marven等。

    lzugis
  • Docker采用Dockerfile方式构建Tomcat容器镜像

    注:远程部署的错误请参考Docker开启Tomcat8远程服务端管理角色权限构建tomcat远程部署镜像

    拓荒者
  • Jibx插件使用maven构建Error loading class java.lang.CharSequence错误

    用户4919348
  • 使用Maven插件构建Spring Boot应用程序Docker镜像

    从构建日志中可以很清晰地看到,一开始下载Maven的依赖配置,随后就开始使用Dockerfile中的构建指令定制镜像,并且将项目根路径作为构建上下文。 另外,...

    2Simple
  • Maven部署Web项目到Tomcat的配置

    Maven自动部署实际上调的是Tomcat安装目录下的manager功能。而为了能正常访问http://localhost:8080/manager页面,我们需...

    用户3004328
  • maven编译遇到"编码GBK的不可映射字符"警告的处理

    maven用的是win10的字符集,在winndows命令行输入chcp,返回936表示GBK,如下图:

    程序员欣宸

扫码关注云+社区

领取腾讯云代金券