简体   繁体   English

如何在IntelliJ IDEA 13中更改$ ProjectFileDir $的值?

[英]How can I change the value of $ProjectFileDir$ in IntelliJ IDEA 13?

I've added an item to my Tools menu using the XML below that runs custom actions for my project. 我使用下面的XML在我的“工具”菜单中添加了一个项目,该项目可为我的项目运行自定义操作。

<?xml version="1.0" encoding="UTF-8"?>
<toolSet name="My Project Utilities">
    <tool name="test" showInMainMenu="true" showInEditor="true" showInProject="true" showInSearchPopup="true" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="false">
        <exec>
            <option name="COMMAND" value="C:\path\to\ant.bat" />
            <option name="PARAMETERS" value="my_task -Dmodule.dir=$ProjectFileDir$\my.module" />
            <option name="WORKING_DIRECTORY" value="$ProjectFileDir$/my.working.dir/foo" />
        </exec>
    </tool>
</toolSet>

When I try to run this task, I get this error: 当我尝试运行此任务时,出现以下错误:

Error running test:
Cannot start process, the working directory C:\projects\something\my.working.dir\foo does not exist

The problem is $ProjectFileDir$ points to the wrong directory, C:\\projects\\something , and I need it to point to C:\\projects . 问题是$ProjectFileDir$指向错误的目录C:\\projects\\something ,我需要它指向C:\\projects Is there a way to change the value of $ProjectFileDir without modifying the value of WORKING_DIRECTORY in my XML? 有没有一种方法可以更改$ProjectFileDir的值而不修改XML中的WORKING_DIRECTORY的值?

we did the samething but with a batch file . 我们做了同样的事情,但是有一个批处理文件。 uploading the batch file and adding the project path at working directory . 上传批处理文件并在工作目录中添加项目路径。

Go to File >> Settings >> External Tools >> Add (+) Create Tool , you can follow the image. 转到文件>>设置>>外部工具>>添加(+)创建工具,您可以跟踪图像。 Hope this helps. 希望这可以帮助。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM