未能执行目标 com.spotify:docker-maven-plugin:1.2.1:build (build-image)

Posted

技术标签:

【中文标题】未能执行目标 com.spotify:docker-maven-plugin:1.2.1:build (build-image)【英文标题】:Failed to execute goal com.spotify:docker-maven-plugin:1.2.1:build (build-image) 【发布时间】:2020-11-25 02:15:13 【问题描述】:

我正在尝试部署一个项目,但最后我得到了这个错误,我不知道这是什么意思或如何解决它

The requested profile "enable-docker-prod" could not be activated because it does not exist.

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.2.2:push (push-image) on project myalert-v2-backend: Exception caught: Get https://172.19.47.33:5000/v1/_ping: dial tcp 172.19.47.33:5000: getsockopt: no route to host -> [Help 1]

这是 pom.xml

中的配置文件
<profiles>
    <profile>
        <id>enable-docker-preprod</id>
        <properties>
            <docker.registry>10.75.6.44:5000</docker.registry>
            <skipDocker>false</skipDocker>
        </properties>
    </profile>
    <profile>
        <id>enable-docker-prod</id>
        <properties>
            <docker.registry>172.19.46.169:5000</docker.registry>
            <skipDocker>false</skipDocker>
        </properties>
        <repositories>
            <repository>
                <id>releases</id>
                <name>releases</name>
                <url>http://repo.jenkins-ci.org/releases/</url>
                <snapshots />
            </repository>
            <repository>
                <id>SRVDEV-ARTFAC-snapshots</id>
                <url>http://172.19.46.238:8081/artifactory/libs-snapshot-local</url>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>central</id>
                <name>plugins-release</name>
                <url>http://172.19.46.238:8081/artifactory/plugins-release</url>
            </pluginRepository>
            <pluginRepository>
                <id>jcenter-snapshots</id>
                <name>jcenter</name>
                <url>http://oss.jfrog.org/artifactory/oss-snapshot-local/</url>
            </pluginRepository>
            <pluginRepository>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
                <id>jcenter-releases</id>
                <name>jcenter</name>
                <url>http://jcenter.bintray.com</url>
            </pluginRepository>
        </pluginRepositories>
    </profile>
</profiles>

请帮助以了解问题所在,谢谢。

【问题讨论】:

我可以建议如下: 【参考方案1】:

我可以建议,

    如果你想将你的工件部署到工件中,你需要有 distributionManagement 标签(语法参考谷歌)

    然后像运行 mvn 命令。 mvn clean deploy -Penable-docker-prod

注意:这里将帮助您从配置的存储库中下载依赖jar,它与部署无关。

要将您的工件部署到您的工件(如工件、jfrog)中,您必须拥有...我希望这些信息有用。

【讨论】:

以上是关于未能执行目标 com.spotify:docker-maven-plugin:1.2.1:build (build-image)的主要内容,如果未能解决你的问题,请参考以下文章

如何配置 com.spotify.dockerfile-maven-plugin 在 Docker Toolbox 上运行?

com.spotify.docker.client.DockerRequestException:请求错误:删除 unix://localhost:80/v1.12/containers/...:40

docker maven 出错:Failed to execute goal com.spotify:docker-maven-plugin:...: Request error: POST http

Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (build-image) on project training

未能执行目标 org.springframework

未能在 GitLab CI 管道中执行目标