$ProjectFileDir$ is empty when used in 'External tool'


I added a pre-make step to run $ProjectFileDir$/build_native.sh, which builds all my ndk stuff. But IntelliJ dumps

Error running build ndk: Cannot run program "/build_native.sh"

so $ProjectFileDir$ translates to empty. Is there anything I have to do before using IntelliJ variables?



Sorry for trouble, it is a bug: http://youtrack.jetbrains.com/issue/IDEA-103303

Welcome to vote and comment.



Upvoted. Is it possible to bump its priority? It seems quite critical since any external build relying on project variables would fail.


I've changed to Major, but this is actually not essential. The developer should make his decision.



Although it says the bug is fixed: https://youtrack.jetbrains.com/issue/IDEA-103303, it is not.

It is replacing $ProjectFileDir$ with an empty string.

This is in the Run/Debug Configurations -> Before launch -> Run External Tool -> Edit Tool -> Tool settings

It would be greatly appreciated to be fixed because these configurations are shared between the developers.

We also tried other macros and they are all replaced by an empty string.

The version we are using is:

IntelliJ IDEA 2017.3 (Community Edition)
Build #IC-173.3727.127, built on November 27, 2017
JRE: 1.8.0_152-release-1024-b6 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 7 6.1


Thank you! Your work is always much appreciated.



this is still not fixed.



Could you please add steps to reproduce the issue? What IDE version do you use?



I'm still suffering from this issue with IntelliJ 2020.1.

If I have a configuration that has an external tool with $ProjectFileDir$ in it, it works correctly. HOWEVER, if I create a second configuration that runs the first configuration as a pre-build step, then the tool is not passed in the variable.

Basically my setup is this:

Configuration 1:  "build" configuration of sorts.

    1. run external tool cmd /c del $ProjectFileDir$\some\output\*.jar
    2. Proceed with build

Configuration 2: "run my app" configuration of sorts
   1. Run other configuration as a pre-build step, specifically Configuration 1
   2. Proceed with run


If I run Configuration 1, the del task (this is on Windows) will work fine.

If I run Configuration 2, when IT runs Configuration 1, the del task will not be passed in a $ProjectFileDir$.  It will be empty.



Sosman thanks for the report, I've reproduced the problem and submitted it to YouTrack: https://youtrack.jetbrains.com/issue/IDEA-238934 .


Please sign in to leave a comment.