Spring Cloud(2) |No plugin found for prefix 'docker' in the current project and in the plugin groups

用docker部署Spring Cloud项目的时候,运行命令:

mvn package docker:build

报如下错误:

at 1.6 KB/sec)
Downloaded: http://3.2.4.2:8888/repository/maven-public/org/apache/maven/plugins/maven-metadata.xml (14 KB at 5.7 KB/sec)
Downloaded: http://3.2.4.2:8888/repository/maven-public/org/codehaus/mojo/maven-metadata.xml (21 KB at 7.3 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] eureka-server ...................................... SUCCESS [ 26.279 s]
[INFO] service-1 ......................................... SUCCESS [ 14.649 s]
[INFO] demo1 ........................................... FAILURE [  2.850 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.535 s
[INFO] Finished at: 2017-11-15T14:28:05+08:00
[INFO] Final Memory: 47M/532M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'docker' in the current project and in the plugin groups [org.sonatype.plugins, org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/../Repository), nexus (http://3.2.4.2:8888/repository/maven-public/)]

pom.xml中文件是:

<build>  
        <plugins>  
            <plugin>  
                <groupId>org.springframework.boot</groupId>  
                <artifactId>spring-boot-maven-plugin</artifactId>  
            </plugin>  
            <!-- tag::plugin[] -->  
            <plugin>  
                <groupId>com.spotify</groupId>  
                <artifactId>docker-maven-plugin</artifactId>  
                <version>0.4.13</version>  
                <configuration>  
                    <imageName>${docker.image.prefix}/${project.artifactId}</imageName>  
                    <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>  
                    <resources>  
                        <resource>  
                            <targetPath>/</targetPath>  
                            <directory>${project.build.directory}</directory>  
                            <include>${project.build.finalName}.jar</include>  
                        </resource>  
                    </resources>  
                </configuration>  
            </plugin>  
            <!-- end::plugin[] -->  
        </plugins>  
    </build>

检查pom文件没有任何问题,最后发现在maven的conf/setting.xml中要加入:


<pluginGroups>  
    <pluginGroup>com.spotify</pluginGroup>  
</pluginGroups>

然后再运行mvn package docker:build, 就OK了!

猜你喜欢

转载自blog.csdn.net/qq_32440951/article/details/80322419