How to exclude a folder that is producing warnings/errors in an Eclipse project?

后端 未结 8 1417
长发绾君心
长发绾君心 2020-12-08 01:48

Okay. I\'m sick of this problem. This has to have an easy fix, I\'m sure of it!! I hope SO can help me to get rid of this once and for all!

相关标签:
8条回答
  • 2020-12-08 02:22

    I encountered a similar problem and resolved it by moving the folder into my project folder. I then went to:

    1. Project > Properties > Resource > Resource Filters > Add...
    2. Set Filter type = Exclude all.
    3. Set Applies to = Folders.
    4. Set File and Folder Attributes = { Name, matches, < your_folder_name > }
    0 讨论(0)
  • 2020-12-08 02:26

    There is an Eclipse feature request for ignoring warnings from specified source folders. There have been several patches posted to the comment thread that provide implementations of the feature. It appears that a final patch is nearing the review stage for inclusion in an upcoming release.

    Update 6/19/2012: Eclipse Juno 4.2M6 supports ignoring problems for a particular source folder. The feature is available on the Java Build Path dialog. See the release note.

    0 讨论(0)
  • 2020-12-08 02:27

    Go to Java Build Path -> Source -> Add Folder

    Choose the right folders which needs to be part of Build Path

    In the above Screen shot src/main/resources needs to be removed from the build as it results in compilation error [wrong package ID]. Hence Include the Folder till src/main/resources .

    I did try Build Path -> Exclude. This does not actually solve the problem. i.e though the RedX mark is cleared from the Eclipse, it will no more be right Java projects. I.e user may not be able to run JUnit Test cases/ debug etc.

    But by including right folders, we can continue with as Java Project.

    0 讨论(0)
  • 2020-12-08 02:27

    The best approach is to use the Inclusion and Exclusion Patterns option in the Java Build Path.
    For example if you want to exclude one project of being automatically build:
    1- Go to its Properties->Java Build Path->Source.
    2- Expand the folder in the "Source folders on the build path:" area
    3- Select Exclude->Edit
    4- In the exclusion patterns add **
    Note: for more information on this patterns: Include and Exclusion Patterns

    0 讨论(0)
  • 2020-12-08 02:28

    Since the files in the resource folder rarely change, I suggest to put them into a second project (where you can set different warning options) and then access that via a relative path (like ${basedir}/../special-tomcat).

    0 讨论(0)
  • 2020-12-08 02:29

    If you really want to exclude certain classes/packages from autobuild you can just right click on them and select Build Path -> Exclude

    alt text

    0 讨论(0)
提交回复
热议问题