user.home 디렉토리에 쓰지 못하도록 Eclipse 위치를 어떻게 수정합니까? (How modify Eclipse locations to prevent write to user.home directory?)


문제 설명

user.home 디렉토리에 쓰지 못하도록 Eclipse 위치를 어떻게 수정합니까? (How modify Eclipse locations to prevent write to user.home directory?)

저는 모든 다른 설정을 시도했고 예, eclipse.ini 및 config.ini를 알고 있으며 다른 명령줄 인수도 시도했습니다! 아무것도 내 문제를 해결하지 못했습니다!

모든 시도와 여전히 eclipse.exe를 실행할 때마다 내 사용자 홈, 즉 .eclipse 및 .p2 폴더에 쓰기를 원합니다.

다른 조합으로도 아래의 모든 설정을 시도했습니다.

‑Dosgi.user.area=file:/c:/eclipse‑conf/e46
‑Dosgi.configuration.area=file:/c:/eclipse‑conf/e46
‑Dosgi.instance.area=file:/c:/eclipse‑conf/e46
‑Declipse.p2.data.area=file:/c:/eclipse‑conf/e46/p2
‑Dorg.eclipse.equinox.p2.configurationFolder=file:/c:/eclipse‑conf/e46/p2
‑Dorg.eclipse.equinox.p2.installFolder=file:/c:/eclipse‑conf/e46/p2
‑Dorg.eclipse.equinox.p2.reconciler.dropins.directory=file:/c:/eclipse‑conf/e46/p2
‑Dorg.eclipse.equinox.p2.cache=file:/c:/eclipse‑conf/e46/p2
‑Dorg.eclipse.equinox.p2.roaming=file:/c:/eclipse‑conf/e46/p2
‑Dorg.eclipse.equinox.p2.cache.shared=file:/c:/eclipse‑conf/e46/p2

이 방법은 도움이 되지 않았습니다! /e46/e46/p2 폴더에 쓰지만 c:\users\mrsimplemind\에 또한 생성/씁니다. . 이클립스 & .eclipseextension & .p2 수동으로 폴더를 생성해도 도움이 되지 않습니다.

이제 여기 있는 사람이 Eclipse 구성 출력을 완전히 분리하는 데 성공했습니까?

이를 달성한 유일한 방법은 user.home을 변경하는 것이지만 이 해결 방법이 마음에 들지 않습니다. 예를 들어 .ssh , .git , .m2 maven 등과 같이 이클립스에 필요할 원래 "user.home"의 항목입니다. 각 Eclipse user.home에 대한 프로필 설정의 중복을 유지하고 싶지 않습니다.

일식을 분리하고 싶습니다. 구성 가능해야 합니다! user.home 에 대한 출력이 마음에 들지 않습니다 .. 옵션이 아닙니다! 각 eclipse 설치에 대해 eclipse가 어떤 폴더에 생성하는지 제어하고 싶습니다.

(Windows os에서만 알 수 있습니다. Mac의 Eclipse가 위의 설정으로 더 잘 작동하는지 모르겠습니다. )



참조 솔루션

방법 1:

The method I have tried to solve this problem has been nearly successful. Whether this is an answer for you will depend on your minimum acceptable level of quality.

  • If you are trying to prevent your Eclipse IDE from filling up your home drive, this technique will work (it has worked for me). It should not matter if Eclipse was installed by Oomph or from a plain zip, as nothing Oomph‑related is modified in this solution.
  • If the requirement is that the user home p2 folder can be completely deleted and yet Eclipse still works without recreating that directory, no I have not been able to achieve that yet.

I am posting this as a partial solution, perhaps in the hope someone else can build upon it to figure out a better workaround. Obviously the perfect solution would be if eclipse had a configurable download location and the installer actually installed all software to only the location selected, but that requires the Eclipse developers to fix the "P2" component of the product. What follows is only a workaround.

Strategy

The premise is that the download pool folder always seems to be hardcoded into the config files to be under the home folder of the user that ran the eclipse installer. The essence of this workaround is to create a fake user home folder in the location of your choice, do a massive find‑and‑replace in the config files, and then force the Java system property to use that new folder as "user.home" which fools Eclipse into using it for its downloads.

Method

This was tested on Eclipse 4.7 Oxygen.3A on Mint Linux. Extensive brain surgery of the Eclipse installation folder is needed.

  1. Install Eclipse somewhere other than your user's home drive. In this example the Oomph installer was given /media/LINAPPS/ubuntu‑apps/eclipse‑oxy as the install target, which then creates /media/LINAPPS/ubuntu‑apps/eclipse‑oxy/eclipse during the installation.
  2. Start Eclipse at least once, then close it and make sure Eclipse is not running.
  3. Create a new fake user home drive folder underneath the Eclipse folder. In this example I created eclipse‑oxy/eclipse/fakeHome
  4. Copy the entire (hidden) p2 directory from your user home directory into the new fakeHome. eg cp ‑R /home/$USER/.p2 /media/LINAPPS/ubuntu‑apps/eclipse‑oxy/eclipse/fakeHome/.p2
  5. Go to the eclipse folder and edit the eclipse.ini in a text editor. Make these 2 changes:
    • set the line after ‑‑launcher.library to be the copy of the pool in the new location relative to the eclipse folder, eg : fakeHome/.p2/pool/...etc...
    • append a new system property setting to end of the file after all the other vm arguments, and set user.home to the new fake user home directory. eg: ‑Duser.home=/media/LINAPPS/ubuntu‑apps/eclipse‑oxy/eclipse/fakeHome
  6. Edit the file eclipse/configuration/org.eclipse.update/platform.xml. Find the first <site> entry and change the url attribute to be the new pool folder relative to the eclipse folder. eg: url="file:fakeHome/.p2/pool/"
  7. Edit the file /media/LINAPPS/ubuntu‑apps/eclipse‑oxy/eclipse/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info and again find and replace all references to you user home's p2 folder with the new p2 folder under the fakeUser. You could find over 1000 matches to replace here. It again seems to be possible to make these relative to the eclipse folder, so a path of "fakeHome/.p2/pool/....." will work.
  8. Go to the new /eclipse/fakeHome/.p2 folder and edit both of the files there "pools.info" and "profiles.info". Again find any reference to your real user home and replace it with the path to the fakeUser folder. Use the full pathname (from root) for the pool location in both of these files.
  9. Unpack, edit, and repack the latest profileRegistry. Find the folder eclipse/fakeHome/.p2/org.eclipse.equinox.p2.engine/profileRegistry/_media_LINAPPS_ubuntu‑apps_eclipse‑oxy_eclipse.profile/. Now find the latest timestamped gz file in that folder. For example it might be called "1529736854441.profile.gz". gunzip that .gz file. Edit the .profile file and again replace any mention of your real user home with the new fakeUser folder. For example in my installation one of the first property settings had to be changed to <property name='org.eclipse.equinox.p2.cache' value='/media/LINAPPS/ubuntu‑apps/eclipse‑oxy/eclipse/fakeHome/.p2/pool'/> Delete the old gz file, then gzip the profile into a gz, so it has replaced the old one.
  10. I also edited the file /eclipse/fakeHome/.p2/org.eclipse.equinox.p2.core/cache/artifacts.xml and replaced the repository name with a reference to the new location inside fakeHome, but I am not sure this was necessary to get eclipse working.
  11. Start eclipse.

Results

After doing the above, I tried to add Install New Software from the Help menu. After downloading lots of new plugins from Redhat and Spring, the new fakeHome pool occupies 900MB, but the original user home pool is still less than 400MB which is what it was as soon as eclipse had been installed. So it has been successful at moving the download cache of the updater and no files get updated in the old location, but two directories under .p2 still seem to have their timestamps touched.

If anyone finds this useful, or figures out how to improve it, please let me know.

방법 2:

This works on Windows 7, Eclipse Oxygen:

  • Install Eclipse, but DON'T launch it yet
  • Edit eclipse.ini and, underneath ‑vmargs, add an entry to change user home to be a shared folder:

e.g.

‑vmargs
‑Duser.home=C:\Development
  • Launch Eclipse. Should see ".eclipse", ".tooling", etc folders created in shared folder, and nothing created under your user folder.

방법 3:

As of Eclipse Java 2019‑06 for Windows 10 64‑bit

I added my eclipse.ini below:

‑vmargs

‑D"user.home=C:\your_path_here"

The 3 folders of .eclipse, .p2, & .tooling appeared after I started and then closed eclipse.

I am not sure when these are written into the new path, but it worked in my Windows 10.

방법 4:

Did you try adding the following line to eclipse.ini below ‑vmargs:

‑Dosgi.configuration.area=@user.home/.someFolder

which will use .someFolder instead of .eclipse or

‑Dosgi.configuration.area=C:\path_to_desired_location\.eclipseJAVA

(by MrSimpleMindandrew8088David LavenderYing Chiu Luksim)

참조 문서

  1. How modify Eclipse locations to prevent write to user.home directory? (CC BY‑SA 2.5/3.0/4.0)

#equinox #eclipse-luna #eclipse-neon #eclipse #p2






관련 질문

Eclipse에서 OSGi 래퍼 번들을 실행할 수 없습니다. .jar은 잘 빌드되고 있지만 파일을 대상/클래스에 복사하려면 어떻게 해야 합니까? (Can't run OSGi wrapper bundle in Eclipse; .jar is building okay, but how do I also copy files into target/classes?)

최대 절전 모드 5.0 + 춘분 4.5.0 및 사용자 정의 UserType (hibernate 5.0 + equinox 4.5.0 and custom UserType)

Domino에 OSGi 서블릿 배치(IBM 프리젠테이션) - 404 오류 (Deploying OSGi Servlet to Domino (IBM presentation) - 404 error)

Java 7을 사용하여 Equinox 3.8.2 프로젝트 컴파일 (Compile Equinox 3.8.2 Project with java 7)

OSGI 애플리케이션에서 EntityManager를 제공하는 모범 사례 (Best practice to provide EntityManager in OSGI applications)

Eclipse RCP 제품 파일 - 플랫폼별 종속성이 있는 여러 플랫폼을 처리하는 방법 (Eclipse RCP Product File - how to handle multiple platforms with platform specific dependencies)

OSGI 번들이 설치 및 시작되었지만 출력이 표시되지 않음 (OSGI Bundle Installed and Started but no visible output)

Jetty 서버의 포트(Equinox OSGi) (Port in Jetty server (Equinox OSGi ))

Equinox에서 Arquillian 실행 (Running Arquillian in Equinox)

OSGi 가져오기 버전 제한을 동적으로 설정하시겠습니까? (Setting OSGi import version restrictions dynamically?)

OSGI의 AspectJ LoadTimeWeaving (AspectJ LoadTimeWeaving on OSGI)

user.home 디렉토리에 쓰지 못하도록 Eclipse 위치를 어떻게 수정합니까? (How modify Eclipse locations to prevent write to user.home directory?)







코멘트