Tag Archives: docker exploration

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

执行goal com.spotify:docker-maven-plugin:1.0.0:build Exception caught: basedir src/main/docker不存在

使用docker部署Spring Cloud项目,一些代码在pomc .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>

[INFO] [INFO] – spring-boot-maven-plugin:1.5.2。发布:repackage
(default) @ eureka-server- [INFO] [INFO] –
docker-maven-plugin:1.0.0:build (default-cli) @ eureka-server-
[ConfigFileRegistryAuthSupplier] [INFO]复制
/Users/eureka-server/target/eureka-server-0.0.1- snapshot .jar ->
/用户/ eureka-server /目标/码头工人/ eureka-server-0.0.1-SNAPSHOT.jar

[信息]——[信息]构建失败[信息]
-[信息]总时间:6.728秒[信息]了:
2017 – 11 – 15 – t20:51:07 +喂饲[信息]最后的记忆:41米/ 361 m[信息]

(错误)未能执行目标com.spotify: docker-maven-plugin: 1.0.0:构建(default-cli)项目
eureka-server:异常捕获:basedir src/main/docker不
存在->要查看
错误的完整堆栈跟踪,请使用-e开关重新运行Maven。[错误]使用
的-X开关重新运行Maven以启用完整的调试日志记录。[ERROR] [ERROR]更多
关于错误和可能的解决方案的信息,请阅读
以下文章:[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException


我的项目有src/main/docker这个文件,怎么解决

将项目路径添加到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>

请查看我的stackoverflow:
https://stackoverflow.com/questions/47308102/ failedto -execute- target -com-spotifydocker-maven-plugin1-0- 0build-excep-cau