Skip to content

Add documentation tip showing how to configure publishRegistry maven properties from the command line #31024

@ffroliva

Description

@ffroliva

If I have a private registry and I want to publish the generated docker image I need to provide username, password, and url in the maven pom.xml.

...
<plugin>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-maven-plugin</artifactId>
  <configuration>
    <image>
      <name>${docker.image.prefix}/${project.artifactId}:${project.version}</name>
    </image>
    <docker>
      <publishRegistry>
        <username>USERNAME</username>
        <password>PASSWORD</password>
        <url>URL</url>
      </publishRegistry>
    </docker>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>build-image</goal>
      </goals>
    </execution>
  </executions>
</plugin>

I would like to be able to send this variables over the command line as follows:

mvn spring-boot:build-image \
-DskipTests \
-Dspring-boot.build-image.imageName=nexus:8870/rcl/op-risk-ui:test \
-Dspring-boot.build-image.publishRegistry.username=<USERNAME> \
-Dspring-boot.build-image.publishRegistry.password=<PASSWORD>
-Dspring-boot.build-image.publishRegistry.url=<URL>

Currently the following variables doesnt exist for the command line:

  • -Dspring-boot.build-image.publishRegistry.username
  • -Dspring-boot.build-image.publishRegistry.password
  • Dspring-boot.build-image.publishRegistry.url

I believe they should be created here:
https://github.com/spring-projects/spring-boot/blob/82b90d57496ba85be316b9eb88a36d81f2cc9baa/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildImageMojo.java

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by another

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions