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
报如下错误:
<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