简体   繁体   English

是否可以从IntelliJ中的内容根目录中排除文件?

[英]Is it possible to exclude a file from the content root in IntelliJ?

I want to exclude individual .java files from a Content Root in IntelliJ. 我想从IntelliJ中的内容根中排除单个.java文件。 The documentation on "Excluding Files from Project" suggests that this is not possible (it explicitly says This action is not applicable to Java files and binaries. ) “从项目中排除文件”文档表明这是不可能的(它明确说明此操作不适用于Java文件和二进制文件。

Being incredulous to such a limitation, I have tried editing my .iml file, optimistically inserting XML elements such as <excludeFile> under the <content> element, but nothing seems to take. 由于对这样的限制.iml ,我尝试编辑我的.iml文件,乐观地在<content>元素下插入<excludeFile>等XML元素,但似乎没有采取任何措施。

Does anyone know a way to do this (documented or otherwise)? 有没有人知道这样做的方法(记录或其他方式)? Or have any clue why this feature is not supported? 或者有任何线索为什么不支持此功能? By comparison, Eclipse allows for an arbitrary including pattern for a <classpathentry> element in its .classpath file. 相比之下,Eclipse允许在其.classpath文件中为<classpathentry>元素设置任意including模式。

You can exclude files from compilation and classpath . 您可以从编译和类路径中排除文件 As far as I understand it will have the same effect as manipulating with <classpathentry> in Eclipse. 据我所知,它与在Eclipse中使用<classpathentry>进行操作具有相同的效果。

To exclude files/folders by pattern and globally use Ignore files and folders option in the File Types dialog. 要按模式排除文件/文件夹,请在“ 文件类型”对话框中全局使用“ 忽略文件和文件夹”选项。 This way the files will be completely ignored and not visible in the Project View, but it's probably not what you want. 这样,文件将被完全忽略,并且在项目视图中不可见,但它可能不是您想要的。

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

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