eclipse나 sts에서 Gradle프로젝트를 import하거나 할때 Project and External Dependencies가 나오지 않는 경우가 종종 발생한다.

이전 Maven프로젝트에서 의존성라이브러인 Maven Dependencies가 나오지 않는 경우와 유사한것이다.

구글링을 통해 이런저런 방법을 사용해 보았으나 딱히 적용이 안되어서 본인의 경우에는 프로젝트 루트에 위치한 .project 파일을 직접 수정해서 살려냈다. 

 

위 파일은 Ctrl + Shift + r 을 눌러 파일명으로 검색해서 찾는것이 빠르다. 숨겨진 파일이고 Project Explorer에 나오지 않음.

아래는 일반적인 gradle project의 .project 파일형태이다.

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>testGradle</name>
	<comment>test</comment>
	<projects></projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.wst.validation.validationbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.jdt.core.javanature</nature>
		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
		<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
		<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
		<nature>net.harawata.mybatipse.MyBatisNature</nature>
	</natures>
</projectDescription>

아래는 Project and External Dependencies 가 나오지 않을때의 .project파일이다.

 

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>testGradle</name>
	<comment>test</comment>
	<projects></projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.wst.common.project.facet.core.builder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.wst.validation.validationbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.jdt.core.javanature</nature>
		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
		<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
		<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
		<nature>net.harawata.mybatipse.MyBatisNature</nature>
	</natures>
</projectDescription>

 

예상하기론 Project Properties의 Buidlers에 나오는 목록을 나타내는 파일인데 여기서 Gradle과 상관없는 project.facet.core.nature형태가 추가가 되는 경우이다. 

 

위 Builders에서 Facet Project Validation Builder를 Remove하고 싶은데 버튼이 비활성화가 되어 제거할수 없다. checkbox해제를 해도 해결되지 않는다. 

그래서 결론은 .project파일을 직접 수정해서 이 프로젝트가 Gradle 프로젝트라는 것을 eclipse에게 알려줘야 하는것으로 판단된다. 

결론은 .proejct파일을 열어서 facet 부분을 제거하고 새로고침하면  Project and External Dependencies 항목이 정상적으로 나온다는 사실. 

 



eclipse(STS) Decompiler Plugin 적용

Posted 2020. 6. 23. 11:05

업데이트한 STS4.6.1에서 적용완료.

1. jad.exe, JadClipse Plugin for Eclips & STS 를 다운받습니다. (아래 링크 확인)

  jad.exe : http://varaneckas.com/jad/

 plugin : https://sourceforge.net/projects/jadclipse/

가끔 위에서 다운받은 jad.exe가 작동하지 않는 경우가 있다.  본인도 그러했음. 그래서 예전에 다운받아놓은걸로 변경.

jadnt158.zip
0.23MB

2. 다운받은 Plugin jar 파일을 {ECLIPSE_HOME}/plugins/로 이동 후 Eclipse 재시작

3. Menu > Windows > Preferences > java 에 JadClipse 메뉴가 생김.

   jad.exe 위치를 full path로 설정한다.

4. Menu > Windows > Preferences > General > Editors > File Associations >

 *.class, *.class without source  의 Viewer를 JadClipse(default)로 변경한다. 안보이면 하단의 Add 버튼 클릭하여 추가.

주의 : 이렇게 해도 안되는 경우가 있다면 jad.exe정상작동여부를 확인한다.