Intellij exclude file from being compiled

2019-01-18 13:40发布

I am trying to exclude a particular file in my project from being compiled.

According to the Intellij IDEA documentation you do this by "marking the file as plain text".

However, the context menu in the project view where this functionality is supposedly located has no such action. I am using version 13.02 of Intellij. Here is what my context menu looks like:

enter image description here

2条回答
Bombasti
2楼-- · 2019-01-18 14:15

Just to compound on Makoto's answer (would comment but don't have reputation), it looks like this feature does not apply to classes (.java) or assets (images)...for these types of files, it looks like you will need to actually go to the compiler and explicitly state that the file(s) should be excluded.

However, for .htm, .xml, or really anything that isn't a class or asset you will find and can use the 'Mark as plain text' option.

Edit: It looks like you can also go to the 'Messages Make' error / warnings view and Exclude from there, a little less work IMHO. Messages Make shortcut

查看更多
甜甜的少女心
3楼-- · 2019-01-18 14:27

Under File > Settings > Build, Execution, Deployment > Compiler > Excludes, add an entry.

enter image description here

Any attempts to run a path specified here will result in a ClassNotFoundException, and a very important class indicator as well.

enter image description here

查看更多
登录 后发表回答