spotify / docker-maven-plugin

INACTIVE: A maven plugin for Docker
Apache License 2.0
2.67k stars 575 forks source link

Poor error message: "Exception caught: You must specify an "imageName" in your docker-maven-client's plugin configuration" #410

Closed nhooey closed 5 years ago

nhooey commented 5 years ago

Description

I get the following error:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.2.0:build
(default-cli) on project project-name: Exception caught:
You must specify an "imageName" in your docker-maven-client's plugin configuration
-> [Help 1]

How to reproduce

Run this:

mvn package docker:build -DdockerDirectory=. -DimageName=image-name

With this configuration in the pom.xml:

      <plugin>
        <groupId>com.spotify</groupId>
        <artifactId>dockerfile-maven-plugin</artifactId>
        <version>${dockerfile-maven-version}</version>
        <executions>
          <execution>
            <id>build</id>
            <goals>
              <goal>build</goal>
            </goals>
            <configuration>
              <imageName>repository.tld/${project.artifactId}:${project.version}</imageName>
            </configuration>
          </execution>
          <execution>
            <id>default</id>
            <goals>
              <goal>build</goal>
              <goal>push</goal>
            </goals>
            <configuration>
              <imageName>repository.tld/${project.artifactId}:${project.version}</imageName>
            </configuration>
          </execution>
          <execution>
            <id>push-image</id>
            <phase>deploy</phase>
            <goals>
              <goal>push</goal>
            </goals>
            <configuration>
              <imageName>repository.tld/${project.artifactId}:${project.version}</imageName>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <imageName>repository.tld/${project.artifactId}:${project.version}</imageName>
          <repository>bigterminal.azurecr.io/${project.artifactId}</repository>
          <tag>${project.version}</tag>
          <buildArgs>
            <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
          </buildArgs>
          <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
        </configuration>
      </plugin>

What do you expect

A less useless error message should appear saying exactly where this imageName variable should be defined.

  1. What XPath path in the pom.xml file should it be under?
  2. What exact -D define on exactly what command can it be configured from?

What happened instead

The error message seems to contradict what has already been done.

Software: