IDEA에서 Gradle의 집을 정의하는 방법은 무엇입니까?
Gradle 프로젝트를 IntelliJ로 가져 오려고하는데 Gradle Home
텍스트 상자에 도착하면 텍스트 상자가 자동으로 채워지지 않으며 Gradle Home
유효한 경로에 결과 경로를 입력하지 않습니다 . GRADLE_USER_HOME
환경 변수가 설정되어 있습니다. !) 올바른 경로 이며이 동일한 프로젝트를 Eclipse로 성공적으로 가져올 수있었습니다. 어떤 제안?
디렉토리 를 인쇄 하는 간단한 gradle 스크립트 를 작성할 수 있습니다 GRADLE_HOME
.
task getHomeDir {
doLast {
println gradle.gradleHomeDir
}
}
그리고 이름을 정하십시오 build.gradle
.
그런 다음 다음을 실행하십시오.
gradle getHomeDir
homebrew와 함께 설치 한 경우을 사용 brew info gradle
하여 기본 경로 (예 :) 를 찾아 /usr/local/Cellar/gradle/1.10/
추가하십시오 libexec
.
경로 인 Homebrew를 통해 Mac에 설치
/usr/local/opt/gradle/libexec
~보다 바람직하다
/usr/local/Cellar/gradle/X.X/libexec
전자는 버전 업그레이드 후에도 유지됩니다.
homebrew와 함께 gradle을 설치 한 경우 경로는 다음과 같습니다.
/usr/local/Cellar/gradle/X.X/libexec
여기서 XX는 gradle의 버전입니다 (현재 2.1).
IntelliJ를 사용하는 경우 다음을 수행하십시오.
- 프로젝트를 닫습니다
- (재) 프로젝트 열기
- 오른쪽 하단에 "Import gradle project"메시지가 나타납니다. 딸깍 하는 소리.
- "기본 gradle 래퍼 사용"을 선택하십시오. "로컬 gradle 배포 사용"이 아님
그게 다야.
이것이 Gradle 프로젝트를 가져올 때 IDEA에 Gradle 홈이 설정되지 않은 문제를 해결하는 데 도움이되었습니다.
세 가지 옵션-(A) 기본 래퍼 (B) "gradle 'wrapper'작업 구성"또는 (C) jetbrains로 정의 된 "로컬 gradle 배포": https://www.jetbrains.com/help/idea/gradle-settings .html
A. 기본 래퍼 (권장)
가능하면이 권장 옵션을 선택하십시오. 회색으로 표시되면 옵션 C를 참조하십시오. 그러면 모든 후속 프로젝트에 기본값을 설정해야합니다.
B. Gradle '래퍼'작업 구성
IDEA가 빌드 스크립트에서 gradle 버전을 정의하도록하려면
- gradle 빌드 버전을 실제 gradle 빌드 내에서 작업으로 정의하는 경우이 옵션을 설정하십시오.
jetbrains에서 아래 예 : https://www.jetbrains.com/help/idea/gradle-settings.html
(프로젝트간에 gradle 빌드를 공유하지 않으려는 경우 유용합니다)
C. 로컬 Gradle 배포
1. Run the following command to get gradle location:
brew info gradle (if gradle was installed with homebrew)
2. You are looking for something like this:
/usr/local/Cellar/gradle/4.8.1
3. Next, append 'libexec' to the gradle location you just found:
/usr/local/Cellar/gradle/4.8.1/libexec
"libexec는 다른 데몬 및 다른 프로그램에서 실행하는 시스템 유틸리티 (예 : IDEA)에서 사용하기 때문"입니다. https://unix.stackexchange.com/questions/312146/what-is-the-purpose-of-usr-libexec를 참조 하십시오
4. Finally, put that new path in the Gradle home input box if IDEA prompts you.
This is instruction for MAC only. I had the same problem. I solved it by configuring $GRADLE_HOME
in .bash_profile
. Here's how you do it:
- Open
.bash_profile
(usually it's located in the user’s home directory). - Add the following lines to update
$PATH
variable:export GRADLE_HOME=/usr/local/opt/gradle/libexec export PATH=$GRADLE_HOME/bin:$PATH
- Save it.
- Apply your changes by running
source .bash_profile
I wrote my own article with instruction in a case if somebody will encounter the same problem.
C:\Users\<_username>\.gradle\wrapper\dists\gradle-3.3-all\55gk2rcmfc6p2dg9u9ohc3hw9\gradle-3.3
\Android studio\gradle didn't worked for me.
And "Default gradle wrapper" wasn't configured while importing (cloning) the project from bitbucket
On a mac it should ideally be at : /Applications/Android Studio.app/Contents/gradle/gradle-2.14.1
(Replace the version string with the latest)
AFAIK it is GRADLE_HOME not GRADLE_USER_HOME (see gradle installation http://www.gradle.org/installation).
On the other hand I played a bit with Gradle support in Idea 13 Cardea and I think the gradle home is not automatically discover by Idea. If so you can file a issue in youtrack.
Also, if you use gradle 1.6+ you can use the Graldle support for setting the build and wrapper. I think idea automatically discover the wrapper based gradle project.
$ gradle setupBuild --type java-library
$ gradle wrapper
Note: Supported library types: basic, maven, java
Regards
If you're using MacPorts, the path is
/opt/local/share/java/gradle
I had to setup the Project SDK before selecting gradle path. Once that was set correctly, I had to choose "Use default gradle wrapper (recommended) in "Import Project from Gradle" dialog.
Still works if I remove gradle using brew:
$ brew remove gradle
This is where my gradle home is (Arch Linux):
/usr/share/java/gradle/
I had some weird errors where it could not find my class, I had to right click on my src folder (was red) to "Make Directory as" -> Source Folder Root
In case you are using Mac, most probably your gradle home should be /usr/local/gradle-2.0
for example.
In preference of IDEA search for gradle and set gradle home as given above. It should work
Click New -> Project from existing sources -> Import gradle project...
Then Idea recognized gradle automatically.
I couldn't get it to accept my Gradle JVM selection until I deleted a broken JDK
아래의 창은 파일-> 기타 설정-> 새 프로젝트 구조 ...입니다.
아래의 Gradle JVM 오류가 사라지고 다음 단계로 넘어갈 수 있음을 삭제하면 여기에 빨간색 1.8 JDK SDK 항목이 있습니다.
참고 URL : https://stackoverflow.com/questions/18495474/how-to-define-gradles-home-in-idea
'Programming' 카테고리의 다른 글
Linq에서 SQL Like %를 수행하는 방법은 무엇입니까? (0) | 2020.02.26 |
---|---|
Java에서 상수를 구현하는 가장 좋은 방법은 무엇입니까? (0) | 2020.02.26 |
SQL Server에서 상위 100 개의 레코드를 업데이트하는 방법 (0) | 2020.02.26 |
단위 테스트와 기능 테스트 (0) | 2020.02.26 |
Bash에서 배열의 요소를 어떻게 결합 할 수 있습니까? (0) | 2020.02.26 |