programing

intelliJ에 패키지가 존재하지 않습니다.

nasanasas 2020. 9. 21. 07:47
반응형

intelliJ에 패키지가 존재하지 않습니다.


바베큐 바코드 인쇄 라이브러리를 사용하려고합니다. 프로젝트 구조 추가 라이브러리를 통해 IntelliJ에 라이브러리를 성공적으로 추가했습니다. 그런 다음 패키지를 가져 와서 메서드를 작성했는데 오류가 발생하지 않았습니다. 패키지는 수업에서 사용할 수 있습니다.

그러나 컴파일하면 오류가 발생합니다.

error: package net.sourceforge.barbecue does not exist

어떻게 이럴 수있어?

우분투에서 코딩하고 있는데 라이브러리를 추가해야하는 다른 장소가 있습니까?

감사. 티카


"Maven> Reimport"를 시도했지만 실제로 수정 한 것은 프로젝트를 닫고 .idea 디렉토리를 삭제 한 다음 프로젝트를 다시 여는 것뿐이었습니다.


다시 가져 오기가 작동하지 않았습니다. 다음은 나를 위해 일했습니다.

파일-> 캐시 무효화 / 다시 시작

그때

빌드-> 프로젝트 다시 빌드

메이븐 프로젝트를 다시 가져옵니다.


프로젝트 / Maven (하단) / Reimport를 마우스 오른쪽 버튼으로 클릭하십시오.

나중에 편집 : 또한 Clover 플러그인을 설치했을 때 이런 일이 훨씬 더 자주 발생하는 것을 보았습니다. 나쁜 습관처럼 플러그인을 버리십시오!


프로젝트 구조에 라이브러리를 추가 한 경우 (Maven을 통하지 않고 다를 수 있음) 관련 모듈에 대한 종속성으로 포함되었는지 확인하십시오.

프로젝트 구조-> 모듈-> 종속성


menu -> build -> Rebuild Project

나를 위해 일했다

(이 단계없이 캐시를 무효화해도 도움이되지 않습니다)


위의 모든 접근 방식을 시도했지만 작동하지 않았습니다. 마침내 실행이 maven clean install해결되었습니다!


캐시 무효화 / 다시 시작빌드-> 프로젝트 다시 빌드가 도움이되었습니다.


IntelliJ를 종료하고 모든 .idea디렉터리를 제거합니다 .

rm -Rf **/.idea/ 

다시 시작하십시오.


꽤 자주 발생하는 매우 성가신 문제입니다. 특히 다른 git 브랜치로 전환 한 후. 이런 종류의 문제를 해결하는 데 너무 많은 시간을 낭비했습니다. 위의 모든 방법을 시도했습니다. 하지만 믿을 수있는 방법을 찾을 수 없습니다. 여기에서는 내 상황에 도움이 될 수있는 단계를 요약합니다. Jetbrains, 고객의 소중한 시간을 절약하기 위해이 문제를 해결하십시오.

  1. 성공한 명령 줄 빌드를 수행했는지 확인하십시오 (UT가 실패한 경우 -Dmaven.test.skip = true를 사용하여 UT를 무시하십시오.
  2. "Maven 프로젝트"보기에서 모든 Maven 프로젝트를 "다시 가져 오기"를 사용해보십시오.
  3. 파일 메뉴에서 "캐시 무효화"를 사용합니다.
  4. .idea 폴더를 삭제하고 기본적으로 작업 영역을 처음부터 만듭니다. (이 문제를 해결할 수있는 유일한 방법입니다.)

13 개의 기존 답변 중 어느 것도 나를 위해 일하지 않았습니다. 그러나 먼저 모든 모듈을 제거하여 문제를 해결할 수 있습니다.

  1. 열기 File> Project Structure...,
  2. Modules탭으로 이동 ,
  3. 모든 모듈을 선택하고 제거 버튼을 누릅니다.

그런 다음 Maven도구 창 에서 나머지 Maven 모듈을 모두 제거합니다 .

  1. 모든 모듈을 선택하고
  2. 마우스 오른쪽 버튼으로 클릭하고
  3. 눌러 Remove projects,

그런 다음 Project도구 창 에서 다시 추가합니다 .

  1. 바로 루트를 클릭 pom.xml,
  2. 눌러 Add as Maven project,

이제 Maven도구 창 에서 무시 된 모듈을 무시합니다 .

  1. 무시 된 (회색) Maven 모듈을 모두 선택하고,
  2. 마우스 오른쪽 버튼으로 클릭하고
  3. 눌러 Unignore,

마지막으로 Build>를 사용하여 다시 빌드하십시오 Rebuild project. 이것은 mvn clean install이미 발생 했다고 가정합니다 .


I had the same problem and it was fixed for me by changing the "Maven home directory" in Settings from "Bundled" to my locally installed maven. Perhaps this triggered some kind of refresh somewhere since I had not changed this setting for months without any issue.


As someone who only occasionally needs to do Java work, this was very annoying. Inevitably, packages would have been added since the last time I ran our server inside IntelliJ and it would fail to build. I found what seems to be an easier solution: just don't build within IntelliJ. Build from the command line via Maven, then make sure that the run configuration does not list Build as a "Before launch" task.


I did re-import all maven projects. This worked for me.enter image description here


I had the same problem. I fixed it by applying the android-apt plugin https://bitbucket.org/hvisser/android-apt


Here is a solution worked for me: Disable the "Use --release option for cross-compilation like the following in intellij idea: got Settings -> Build,Execution,Deployment -> Compiler -> Java Compiler and disable:

Use '--release' option for cross compilation(java 9 and later)


What happens here is the particular package is not available in the cache. Resetting will help solve the problem.

  1. File -> Invalidate Caches /Restart
  2. Goto terminal and build the project again

    ./gradlew build
    

This should download all the missing packages again

참고URL : https://stackoverflow.com/questions/20137020/package-doesnt-exist-error-in-intellij

반응형