Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build Exception caught: basedir src/mai

Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build Exception caught: basedir src/main/docker does not exist

Deploy Spring Cloud project with docker, some code in the pom.xml:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-maven-pluginartifactId>
        plugin>
        
        <plugin>
            <groupId>com.spotifygroupId>
            <artifactId>docker-maven-pluginartifactId>
            <version>1.0.0version>
            <configuration>
                <imageName>${docker.image.prefix}/${project.artifactId}imageName>
                <dockerDirectory>src/main/dockerdockerDirectory>
                <resources>
                    <resource>
                        <targetPath>/targetPath>
                        <directory>${project.build.directory}directory>
                        <include>${project.build.finalName}.jarinclude>
                    resource>
                resources>
            configuration>
        plugin>
        

        <plugin>
            <groupId>org.apache.maven.pluginsgroupId>
            <artifactId>maven-surefire-pluginartifactId>
            <configuration>
                <skipTests>trueskipTests>
            configuration>
        plugin>
    plugins>
build>

when i run the command: mvn package docker:build, it throws the error:

[INFO] [INFO] — spring-boot-maven-plugin:1.5.2.RELEASE:repackage
(default) @ eureka-server — [INFO] [INFO] —
docker-maven-plugin:1.0.0:build (default-cli) @ eureka-server —
[INFO] Using authentication suppliers:
[ConfigFileRegistryAuthSupplier] [INFO] Copying
/Users/eureka-server/target/eureka-server-0.0.1-SNAPSHOT.jar ->
/Users/eureka-server/target/docker/eureka-server-0.0.1-SNAPSHOT.jar
[INFO]
———————————————————————— [INFO] BUILD FAILURE [INFO]
———————————————————————— [INFO] Total time: 6.728 s [INFO] Finished at:
2017-11-15T20:51:07+08:00 [INFO] Final Memory: 41M/361M [INFO]
———————————————————————— [ERROR] Failed to execute goal
com.spotify:docker-maven-plugin:1.0.0:build (default-cli) on project
eureka-server: Exception caught: basedir src/main/docker does not
exist -> [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/MojoExecutionException

my project has this file src/main/docker, how to solve it?

To add project path to the dockerDirectory:

<dockerDirectory>${project.basedir}/src/main/dockerdockerDirectory>

pom.xml:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-maven-pluginartifactId>
        plugin>
        
        <plugin>
            <groupId>com.spotifygroupId>
            <artifactId>docker-maven-pluginartifactId>
            <version>1.0.0version>
            <configuration>
                <imageName>${docker.image.prefix}/${project.artifactId}imageName>
                <dockerDirectory>${project.basedir}/src/main/dockerdockerDirectory>
                <resources>
                    <resource>
                        <targetPath>/targetPath>
                        <directory>${project.build.directory}directory>
                        <include>${project.build.finalName}.jarinclude>
                    resource>
                resources>
            configuration>
        plugin>
        

        <plugin>
            <groupId>org.apache.maven.pluginsgroupId>
            <artifactId>maven-surefire-pluginartifactId>
            <configuration>
                <skipTests>trueskipTests>
            configuration>
        plugin>
    plugins>
build>

please view my stackoverflow:
https://stackoverflow.com/questions/47308102/failed-to-execute-goal-com-spotifydocker-maven-plugin1-0-0build-exception-cau

你可能感兴趣的:(spring,cloud,docker,docker,探索,Spring,Cloud,spring,cloud,docker)