Skip to content
This repository was archived by the owner on Mar 31, 2022. It is now read-only.
This repository was archived by the owner on Mar 31, 2022. It is now read-only.

Artifact not copied when using Maven ${project.build.directory} property #101

@jjjjjjje

Description

@jjjjjjje

Hi,

I am really confused by the following issue. I need your help :).

I have a parent pom, which is used for all my war projects. In this parent pom, I have:

<plugin>
    <groupId>com.spotify</groupId>
    <artifactId>dockerfile-maven-plugin</artifactId>
    <version>1.3.6</version>
    <executions>
        <execution>
            <goals>
                <goal>build</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <repository>${project.groupId}/${project.artifactId}</repository>
        <tag>${project.version}</tag>
        <buildArgs>
            <ARTIFACT>target/${project.build.finalName}.${project.packaging}</ARTIFACT>
        </buildArgs>
    </configuration>
</plugin>

Now, in the child poms, which are war projects, I can do:

<plugin>
    <groupId>com.spotify</groupId>
    <artifactId>dockerfile-maven-plugin</artifactId>
</plugin>

This works really great. As an example, a Dockerfile looks like this:

FROM tomcat

ARG ARTIFACT
ADD ${ARTIFACT} /usr/local/tomcat/webapps/my-project.war

Now to my bug. In the parent pom, if I replace

    <buildArgs>
        <ARTIFACT>target/${project.build.finalName}.${project.packaging}</ARTIFACT>
    </buildArgs>

by

    <buildArgs>
        <ARTIFACT>${project.build.directory}/${project.build.finalName}.${project.packaging}</ARTIFACT>
    </buildArgs>

this is no longer working. I get the following exception:

[ERROR] ADD failed: stat /var/lib/docker/tmp/docker-builder028011685/home/jjjjeee/projects/my-project/target/my-project-1.0.0-SNAPSHOT.war: no such file or directory

However, that file exists. That would also have been the file if I just did target/${project.build.finalName}.${project.packaging} instead of the not working ${project.build.directory}/${project.build.finalName}.${project.packaging}.

Any ideas? This is really confusing me.

Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions