Program Tip

Eclipse 프로젝트에서 경고 / 오류를 생성하는 폴더를 제외하는 방법은 무엇입니까?

programtip 2020. 12. 8. 19:50
반응형

Eclipse 프로젝트에서 경고 / 오류를 생성하는 폴더를 제외하는 방법은 무엇입니까?


괜찮아. 나는이 문제에 질렸다. 이것은 하는 쉬운 수정이, 나는 그것의 확신! 나는 SO가 이것을 단번에 제거하는 데 도움이되기를 바랍니다!

질문

Eclipse가 특정 프로젝트 디렉토리 아래의 모든 파일을 처리 / 컴파일하려는 시도를 중지하려면 어떻게해야합니까? 목표는이 폴더 또는 하위 폴더의 항목과 관련된 경우 문제보기에 오류 / 경고가 존재하지 않는 것입니다.

배경

Eclipse 3.6을 실행하고 m2eclipse 플러그인 v0.10.2.20100623이 자동 빌드를 관리합니다. 내가 통제 할 수없는 이유로, SVN 프로젝트 디렉토리에 전체 BlazeDS 배포가 src/main/resources/blazeds있습니다. 기본적으로이 디렉토리에는 blazeds를 실행하는 바람둥이의 바닐라 배포가 포함되어 있으며 SCP를 통해 서버에 배포 할 때 모든 구성 및 프로젝트 파일이 추가됩니다.

따라서 deploy를 실행할 때이 버전의 tomcat이 서버에 복사되고 프로젝트가 내부에 배치됩니다. Tomcat과 RIA 응용 프로그램이 작동하며 모든 것이 정상입니다.

문제는 Eclipse가 src/main/resources/blazedsAutoBuild를 실행할 때 모든 것을 컴파일하려고 시도 하고 이로 인해 문제보기에서 약 300 개의 오류 / 경고가 생성된다는 것입니다. 따라서 실제 오류가 나타나면 소음 사이에서 손실됩니다.

오류는 코드 /blazeds/tomcat/webapps/samples/testdrive-datapushtestdrive-httpservice, traderdesktop예제 webapps 에서 비롯됩니다 . 클래스 경로에없는 종속 소스 코드와 라이브러리에 포함되지 않은 jar가 있습니다.

실패한 시도 솔루션

나는 적절한 해결책을 추진하려고 노력하고있다 : 샘플을 완전히 제거하고 또한 우리의 버전 관리에서 불명확 한 것을 없애기 위해. 그것은 곧 일어나지 않습니다.

나는 여기에 SO 대답을 따랐 지만 매우 일시적인 해결책 일뿐입니다. 나는 내가 생각할 수있는 모든 곳에서 제외를 추가하려고했고 우리 팀의 다른 구성원들도 똑같이했습니다. src/main/resources소스 디렉토리 (환경 설정> Java 빌드 경로> 소스 탭)에서 제거 했습니다 blazeds. 자원 디렉토리 아래에 대한 제외를 추가했습니다 . 나는 모든 순열을 시도했다 blazeds**같은에서 *blazeds*, **/blazeds/**

컴파일러가 불평하는 라이브러리와 소스 파일을 포함하려고 시도했지만 프로젝트 구성을 과도하게 망가 뜨리지 않고서는 제대로 얻을 수 없었습니다.

요약

이것은 간단해야합니다. Eclipse 프로젝트에서 경고 / 오류를 생성하는 폴더를 제외하는 일반적인 방법은 무엇입니까?


업데이트 # 1 :
아래의 gedim의 솔루션은 괜찮지 만
1) 프로젝트에서 빨간색 X를 지우지 않습니다.
2) 우리 팀의 모든 사람이 수동으로 수행해야하는 변경입니다
(즉, 프로젝트 속성 파일에 없습니다. ) 전복으로 선택하지

나는이 디렉토리가 포함되지 않도록 Eclipse를 말함으로써 핵심 문제를 해결하는 방법이 희망
/ 컴파일 유효성 검사를 항목. 이러한 변경 사항은 프로젝트 설정 파일 중 하나에 나타날 수 있습니다.


업데이트 # 2 :

아래 그림은 내가 지우려고하는 빨간색 X를 보여 주며
Build Path > Exclude
옵션이 아닙니다 ...

빨간색 X는 사라지지 않습니다


You can use the Configure Contents... on the menu of Problems panel. There you can create a new configuration and set the scope to On Working Set:. Click on Select... and create a new working set that excludes the folders you don't want.


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 > }

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.


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

대체 텍스트


Configure your project (Project/Properties/Java Build Path/Source) to have, instead of the top level src folder with exclusions, just a list of the folders you do want to compile.

Assuming Eclipse Helios, step by step:

  • Turn off autobuild (Project/Build Automatically).
  • Start with it empty.
  • Delete the errors by right clicking as in the link (just to be sure).
  • Add genuine source folders 1 by 1 (Project/Properties/Java Build Path/Source/Add Folder)
  • Do an explicit build (Project/Build Project).

If that works, you should be able to turn autobuild back on. If it doesn't, something strange is going on. Perhaps the project is not using the standard Java Builder, but something like an Ant Builder (Project/Properties/Builders).


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.


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).


가장 좋은 방법은 Java 빌드 경로에서 포함 및 제외 패턴 옵션을 사용하는 것입니다.
예를 들어 자동으로 빌드되는 하나의 프로젝트를 제외하려면
1- 속성-> Java 빌드 경로-> 소스로 이동합니다.
2- "빌드 경로의 소스 폴더 :"영역에서 폴더를 확장합니다.
3-
제외- > 편집을 선택합니다. 4- 제외 패턴에서 추가 **
참고 :이 패턴에 대한 자세한 내용은 포함 및 제외 패턴을 참조하십시오.

참고 URL : https://stackoverflow.com/questions/3736208/how-to-exclude-a-folder-that-is-producing-warnings-errors-in-an-eclipse-project

반응형