如何在IntelliJ中将目录标记为生成测试源根目录? [英] How to mark a directory as a generated-test-source root in IntelliJ?

查看:335
本文介绍了如何在IntelliJ中将目录标记为生成测试源根目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在ubuntu上的Intellij 2016.1中试用Dagger2(但不使用gradle).

I'm trying out Dagger2 in Intellij 2016.1 (but not with gradle) on ubuntu.

Intellij可以在任一情况下创建匕首生成的源 ./out/production/<ProjectModule>/generated/./out/test/<ProjectModule>/generated_tests/分别取决于它是从源目录还是从测试目录生成的.

Intellij creates dagger's generated sources in either ./out/production/<ProjectModule>/generated/ or ./out/test/<ProjectModule>/generated_tests/ depending on if it was generated from a source or test directory, respectively.

但是据我所知,我只能将这些目录标记为sources roottest sources rootgenerated sources root;例如,generated test sources root没有任何选择.

But from what I tell, I can only mark those directories as either sources root, test sources root, or generated sources root; there is no option for generated test sources root, say.

为什么这很重要?因为生成的测试源取决于 my 测试源.如果将它们标记为generated sources root,则Intellij无法找到依赖项.

Why is this important? Because the generated test sources depend on my test sources. If they are marked as a generated sources root then Intellij cannot find the dependencies.

注意:我不认为应该将它们标记为test sources root,因为Intellij会尝试再次编译它们.除非有某种我不知道的预防方法.

Note: I don't think they should be marked as test sources root because then Intellij tries to compile those again; unless there is some way of preventing this of which I am unaware.

那么有没有办法将此目录标记为generated test sources root或类似的名称?

So is there a way to mark this directory as a generated test sources root or something equivalent?

推荐答案

要将部门标记为生成的测试源根目录",请在项目设置">模块"中打开项目结构"对话框,然后单击旁边的小"P"到您选择的文件夹,然后选择用于生成的资源"按钮.

To mark a diectory as "generated test sources root", open the "Project Structure" dialog at Project Settings > Modules and click on the little "P" next to your folder of choice, and select the "For generated resources" button.

这篇关于如何在IntelliJ中将目录标记为生成测试源根目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆