-
Notifications
You must be signed in to change notification settings - Fork 491
Using mave in the buildArgs parameter of configuration, can't get ${project.basedir} normally #209
Comments
I don't know if this is a bug or design. |
I think this is a bug, as the plugin somehow modifies the Maven I was using the following configuration in order to avoid hard-coding of the build-directory in the Dockerfile (normally ./target):
The variable I think that the plugin modifies the Note: this happened on Linux 3.10. |
I think it might be intentionally.. If you take a look at the current README: They pass the jar-name like this:
and kind of "configure" the target directory right in the Dockerfile with Assuming you've changed your standard output directory, you misbehave to their very first design goal:
Edit: Besides that I've got no idea why they would change the argument. I just consider it to be intentional. |
The Maven variable To summarize: |
I can’t recall any place in the plugin where this variable is modified - I’m not even sure if it is possible to modify a Maven supplied variable like that. Can anyone point to a piece of code that is doing this? |
One thing to note is that your local workspace is wrapped up and sent to the docker daemon as your “build context” |
That probably is the explanation. But I do not understand why the following works:
Dockerfile:
While, as said before, the following does not work (with the same Dockerfile):
I will try to investigate with a sample project. |
So I created a sample project: https://github.com/boskoop/dockerfile-maven-issue-209 Actually, this issue seems to be a duplicate of #101. The problem is not with the Maven variable itself but with the design of the docker build context, where absolute paths are not allowed. The variable Since more and more people are running into this (as I was too), we should think about improving the documentation. |
for a more complete explanation see #101 |
Is this a BUG REPORT or FEATURE REQUEST?:
Description
Using mave in the buildArgs parameter of configuration, can't get ${project.basedir} normally.
Customize the dockerfile file address
The actual output is
/var/lib/docker/tmp/xxxxxxxxxxxx/${projextPath}/target
eq:
How to reproduce
As described above
What do you expect
How to get the target path of the Maven project normally
What happened instead
Software:
docker version
: 18.06.0-ceFull backtrace
The text was updated successfully, but these errors were encountered: