Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No plugin found for prefix 'docker' in the current project and in the plugin groups

deploy Spring Cloud project with docker, some code in the 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>1.0.0</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>

when i execute the command: mvn package docker:build, it throws the above errors:

    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/)]

how to solve it?

like image 926
Java Basketball Avatar asked Nov 15 '17 07:11

Java Basketball


3 Answers

add the below code to your maven conf/setting.xml

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

if you want to get more detail, pls refer to https://github.com/spotify/docker-maven-plugin/issues/322

like image 195
Java Basketball Avatar answered Nov 03 '22 20:11

Java Basketball


If you are using dockerfile maven plugin, you need to change docker:build to dockerfile:build and docker:push to dockerfile:push

like image 6
Pubudu Jayasanka Avatar answered Nov 03 '22 19:11

Pubudu Jayasanka


For me worked in a different way, if you follow the maven plugin pattern {prefix}-maven-plugin... which in this case is dockerfile-maven-plugin, you should be able to run it with: mvn package dockerfile:build. I'm using Maven: 3, Spring Boot 2 and Docker maven plugin 1.3.4

like image 3
feral Avatar answered Nov 03 '22 20:11

feral