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

spring cloud 同时被 3 个专栏收录
19 篇文章 0 订阅
12 篇文章 1 订阅
37 篇文章 4 订阅

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.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>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[] -->

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <skipTests>true</skipTests>
            </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/docker</dockerDirectory>

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[] -->

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <skipTests>true</skipTests>
            </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

  • 2
    点赞
  • 0
    评论
  • 1
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值