program story

com.sun : tools : jar 아티팩트 누락

inputbox 2020. 10. 19. 08:01
반응형

com.sun : tools : jar 아티팩트 누락


시작하기 튜토리얼을 따라 왔지만 Maven을 사용하여 플레이 프로젝트를 가져온 후에 멈췄습니다. 64 비트 Windows 7에서 실행되는 Eclipse Indigo를 사용하고 있습니다.

가져온 모든 프로젝트에 동일한 오류가 있습니다.

Missing Artifact com.sun:tools:jar in all the pom.xml files.

몇 시간 동안 포럼을 검색 한 후 다음을 시도했습니다.

최신 Java 1.6.029 설치 JRE를 사용하기 위해 Eclipse Java 환경 설정 변경 JAVA_HOME을 가리 키도록 환경 변수 \program files\Java\jdk1.6_029변경 jdk1.6_029.

나는 정말 playn을 실험하고 싶지만 왜 몇 개의 게시물이 있는지 해결책에 대한 합의 답변을 찾을 수없는 것 같습니다. 어떤 사람들은 Sun이 64bit jdk에서 무언가를 제거했다고 말하고, 다른 사람들은 xml 파일을 편집해야한다고 말하고, 많은 사람들이 JAVA_HOME.

이 문제를 해결하는 데 도움을 주시면 감사하겠습니다. 여기에는 특별히 이상한 설정이 없기 때문에 많은 사람들에게 유용 할 것입니다.

(편집) 다음은 첫 번째 프로젝트의 pom.xml입니다. Eclipse는 다음과 같은 줄에 오류를 표시합니다.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>com.googlecode.playn</groupId>
    <artifactId>playn-project</artifactId>
    <version>1.1-SNAPSHOT</version>
  </parent>

  <artifactId>playn-android</artifactId>
  <name>PlayN Android</name>
  <packaging>jar</packaging>

  <repositories>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>com.googlecode.playn</groupId>
      <artifactId>playn-core</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- needed because Android uses the same JSON code as playn-java;
         that should be factored into a library shared by both backends -->
    <dependency>
      <groupId>com.googlecode.playn</groupId>
      <artifactId>playn-java</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>com.google.android</groupId>
      <artifactId>android</artifactId>
      <version>${android.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <sourceDirectory>src</sourceDirectory>
  </build>
</project>

이 문제와 해결 방법 대해이 질문 에 대해 방금 게시 했지만 더 관련성이있어 보이므로 여기에도 붙여넣고 확장하겠습니다.

Eclipse 설정의 JRE 목록에서 JRE를 제거하고 거기에 JDK가있는 경우에도 Windows 7에서 Eclipse를 사용할 때 동일한 문제가 발생했습니다.

내가해야 할 일은 (귀하의 질문에서 언급했듯이) Eclipse를 시작하는 데 사용하는 바로 가기의 명령 줄을 수정하여 다음과 같이 -vm 인수를 추가하는 것입니다.

-vm "T:\Program Files\Java\jdk1.6.0_26\bin"

물론, 당신의 bin 디렉토리를 가리 키도록하는 것이 조정할 것이다 당신의 JDK 설치합니다. 이것이하는 일은 Eclipse 자체가 JRE 대신 JDK를 사용하여 실행되도록하고 tools.jar올바르게 찾을 수있게하는 것입니다.

나는 이것이 아무것도 지정되지 않은 경우 Eclipse가 기본 JRE를 찾는 방법과 관련이 있다고 생각합니다. 나는 그것이 JDK보다 JRE를 선호하는 경향이 있고 (왜, 나는 모르겠다) 그것이 찾은 첫 번째 호환 가능한 JRE를 찾는 경향이 있다고 생각합니다. 그리고 Vladiat0r의 대답과 같은 Windows 레지스트리 키에서 벗어나면 HKLM\Software\JavaSoft\Java Runtime Environment키 대신 키를 먼저 찾습니다 HKLM\Software\JavaSoft\Java Development Kit.


간단한 웹 서비스 응용 프로그램을 개발하는 동안 동일한 문제가 발생했습니다. 제 경우에는 jaxws 라이브러리를 얻기 위해 코드 하우스 플러그를 추가해야했습니다. 그러나 maven pom은 도구 jar 파일에 대해 계속 묻습니다.

위의 설명이 정확하다고 말해야합니다. pom 파일에 아래 항목을 포함 할 수 있습니다.

<dependency>
   <groupId>com.sun</groupId>
   <artifactId>tools</artifactId>
   <version>1.6</version>
   <scope>system</scope>
   <systemPath>C:\Program Files\Java\jdk1.6.0_29\lib\tools.jar</systemPath>
 </dependency>

그러나 프로덕션 인스턴스에 배포해야하는 경우 어떤 일이 발생합니까? 경로를 시스템 환경 변수에 대한 참조로 바꿀 수 있지만 적어도 나에게는 여전히 좋지 않습니다.

StackOverflow 주석에서 다른 해결책을 찾았습니다.

Maven 3 Artifact 문제

<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>${struts2.version}</version>
    <exclusions>
        <exclusion>
            <artifactId>tools</artifactId>
            <groupId>com.sun</groupId>
        </exclusion>
    </exclusions>
</dependency>

그들은 도구 항아리에 대한 제외 문을 포함하도록 제안하고 작동합니다. 요약하자면, 종속성 내에 제외 규칙을 포함하고 tool.jar 문제를 피할 수 있습니다.

 <exclusions>
            <exclusion>
                <artifactId>tools</artifactId>
                <groupId>com.sun</groupId>
            </exclusion>
        </exclusions>

저도 같은 문제로 실행하고 나는 그것을 해결할 수 있었던 방법의 종속성 위치를 추가했다 tools.jarpom.xml. 이렇게 :

 <dependency>
   <groupId>com.sun</groupId>
   <artifactId>tools</artifactId>
   <version>1.6</version>
   <scope>system</scope>
   <systemPath>C:\Program Files\Java\jdk1.6.0_29\lib\tools.jar</systemPath>
 </dependency>

<systemPath>tools.jar 파일이있는 위치로 를 변경해야합니다 .


다른 답변 중 어느 것도 나를 위해하지 않았습니다. eclipse에서 pom.xml의 "Dependency hierarchy"를 확인하는 것이 무엇 이었습니까? 필터 'tools'를 제공하면 tools.jar에 대한 실제 종속성이 있음이 드러났습니다.

Eclipse보기

그래서 저의 범인은 다음과 같습니다.

<dependency>
    <groupId>com.github.markusbernhardt</groupId>
    <artifactId>robotframework-selenium2library-java</artifactId>
    <version>1.4.0.7</version>
    <scope>test</scope>
</dependency>

제외를 추가하면 다음과 같이 수정되었습니다.

<dependency>
    <groupId>com.github.markusbernhardt</groupId>
    <artifactId>robotframework-selenium2library-java</artifactId>
    <version>1.4.0.7</version>
    <scope>test</scope>
    <exclusions>
        <exclusion>
            <artifactId>tools</artifactId>
            <groupId>com.sun</groupId>
        </exclusion>
    </exclusions>  
</dependency>

제외에는 단점이없는 것 같습니다.


Eclipse 4.3 설정에서이 문제를 해결했습니다. JRE 라이브러리에 JDK 라이브러리를 추가하는 것만으로도 해결되었습니다.

Go windows-> 설정-> Java-> 설치된 JRE-> JDK 선택 및 편집 클릭-> 외부 JAR 추가를 클릭하고 tools.jar 추가 (JDK / lib에 있음)


나와 Windows 7도 마찬가지입니다. 결국 다음 두 줄을 추가했습니다 eclipse.ini.

-vm 
C:\Program Files\Java\jdk1.6.0_35\bin

나는 %JAVA_HOME%거기에서 사용해 보았지만 작동하지 않았습니다.


컴퓨터의 JDK 버전을 확인하고 pom.xml둘 다 동일해야합니다.

<dependency>
    <groupId>sun.jdk</groupId>
    <artifactId>tools</artifactId>
    <version>1.8</version>
    <scope>system</scope>
    <systemPath>C:\Program Files\Java\jdk1.8.0_192\lib\tools.jar</systemPath>
</dependency>

잠시 고생 한 끝에 마침내 eclipse.ini명령 줄 대신 이 작업을 수행했습니다 . 마지막으로 문서를 읽은 후 -vm 인수가 따옴표없이 별도의 행에 있어야하며 -vmargs 앞에 있어야한다는 것을 깨달았습니다.

-vm
C:\Program Files\Java\jdk1.7.0_45\bin\javaw.exe

pom 파일의 효과적인 POM 탭에 다음 파생 C:\Program Files\Java\jre6/../lib/tools.jar경로가 표시되며 Windows에서 유효한 경로가 아닌 것 같습니다 . jre6 / lib 폴더와 Java / lib 폴더에 tools.jar을 성공적으로 복사 해 보았습니다.

"C : \ Program Files \ Java \ jre6"값은 레지스트리에서 가져옵니다.

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.6.0_30
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.6

그리고 JavaHome 키를 jdk JRE가 설치된 위치로 설정하십시오. 그런 다음 모든 컴파일러 오류가 사라졌습니다.

JDK를 다시 설치해도 문제가 해결되지 않았습니다. JAVA_HOME 또는 java.home 시스템 환경 변수 설정이 도움이되지 않았습니다.

내가 본 또 다른 대안은 각 pom xml 파일에 올바른 경로로 종속성을 추가하는 것이지만 playn-samples에는 편집해야 할 터무니없는 고통이 많은 파일이 있습니다.

이것은 잘못된 경로를 보여주는 효과적인 POM 결과입니다!

 <dependency>
      <groupId>com.sun</groupId>
      <artifactId>tools</artifactId>
      <version>1.6</version>
      <scope>system</scope>
      <systemPath>C:\Program Files\Java\jre6/../lib/tools.jar</systemPath>
      <optional>true</optional>
    </dependency>

이 종속성을 pom.xml 파일에 추가하십시오. 이 도움을 바랍니다.
에서 <systemPath>재산 당신은 당신의 JDK lib 디렉토리 경로를 작성해야 ..

    <dependency>  
          <groupId>com.sun</groupId> 
           <artifactId>tools</artifactId>
        <version>1.4.2</version>
        <scope>system</scope>
        <systemPath>C:/Program Files/Java/jdk1.6.0_30/lib/tools.jar</systemPath>
        </dependency> 

다른 포스터에서 언급했듯이 여기에있는 문제는 이클립스가 도구 항아리를 찾을 수없는 JRE와 관련이 있습니다. 나는 위에서 언급 한 것과는 조금 다른 방향으로 가면서 문제를 해결했고, 그것은 내 프로젝트와 환경의 방식 때문이었습니다.

Eclipse 4.5는 런타임에 Java 7 이상이 필요하므로 C : \ java \ jre1.8.0_45에있는 Java 8 JRE를 사용하도록 시스템을 설정했습니다.

다음으로 Java 6 JDK로 실행 중이라고 가정하는 POM 파일을 사용하고 있습니다.

  <profiles>
    <profile>
      <id>default-profile</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <file>
          <exists>${java.home}/../lib/tools.jar</exists>
        </file>
      </activation>
      <properties>
        <toolsjar>${java.home}/../lib/tools.jar</toolsjar>
      </properties>
    </profile>
    <profile>
      <id>osx_profile</id>
      <activation>
        <activeByDefault>false</activeByDefault>
        <os>
          <family>mac</family>
        </os>
      </activation>
      <properties>
        <toolsjar>${java.home}/../Classes/classes.jar</toolsjar>
      </properties>
    </profile>
  </profiles>

  <dependencies>
    <dependency>
      <groupId>com.sun</groupId>
      <artifactId>tools</artifactId>
      <version>1.6.0</version>
      <scope>system</scope>
      <systemPath>${toolsjar}</systemPath>
    </dependency>
  </dependencies>

나는 POM 파일을 변경할 수 없기 때문에 약간의 부지런함을해야만했다. Java 6 JDK에서 tools.jar을 복사하고 C : \ java \ lib 디렉토리를 만들어 붙여 넣었습니다. 그런 다음 이클립스를 다시 시작하고 프로젝트를 정리했습니다. 그리고 VOILA 오류가 사라졌습니다.

우아한 솔루션이 아니며 적절한 솔루션은 POM 설정 방식을 변경하는 것이라고 생각하지만 할 수 없었기 때문에 작동합니다.


비슷한 오류가 발생했습니다. 이것은 JDK가 Eclipse에서 제대로 설정되지 않았기 때문입니다. Cucumber는 JRE와 함께 JDK가 필요하므로 pom.xml에 아래 종속성을 추가하십시오.

<dependency>
  <groupId>com.sun</groupId>
  <artifactId>tools</artifactId>
  <version>1.6</version>
  <scope>system</scope>
  <systemPath>C:\Program Files\Java\jdk1.8.0_101\lib\tools.jar</systemPath>
</dependency>

eclipse.ini 수정을 사용하여 끝났습니다.

openFile
-vm (Your Java Home JDK here)

예 : -vm C:\Java\JDK\1.6.

JRE도 JDK로 변경해야했습니다.

Eclipse IDE에서 다음으로 이동하십시오.

  1. 창-> 환경 설정-> 설치된 JRE
  2. 추가를 클릭하십시오 (새 JRE를 찾으려면)
  3. Select standard JVM -> next
  4. Click on Directory to locate JRE home, put JDK_INSTALL_LOCATION and finish.
  5. Go to your java project's Properties -> Java build Path -> Libraries -> select JRE -> Edit -> select Workspace default JRE -> finish
  6. Do a full workspace cleanup with project -> clean.

I had the same problem on a Windows 7 and Eclipse 3.7 I managed to fix it by starting

eclipse.exe -vm "D:\JDK6\bin"

You can start a cmd and launch eclipse like that, or you can edit your shortcut and add -vm "D:\JDK6\bin" as an argument in the "target section".

As a sidenote, I also tried to add -vm "D:\JDK6\bin" to eclipse.ini but did not work. And adding JRE6 will not work since it does NOT contain tools.jar in it's "lib" directory. Only JDK does.


After trying out all the above I was still having the same issue.

  • PATH environment variable point to JDK 1.7\bin
  • My JAVA_HOME environment variable was pointed to the JDK 1.7
  • My eclipse.ini had the javaw -vm entry pointing to JDK 1.7
  • My eclipse preference had JDK 1.7 as the installed JRE.
  • My project build path was using JDK 1.7.

Then I tried the following,

  • Open a command prompt and typed java -version. It showed me a JRE version 1.8.

  • Open a command prompt and went to location of the JDK 1.7 bin directory and typed java -version. This time it showed correctly 1.7.

Then after digging at few places I found that apart from the above locations there are additional locations for Java runtime.

Registry

There is also a registry key where JRE location are specified under

HKLM\Software\Javasoft\Version

I changed the entries here to point to the JDK 1.7

ProgramData

The directory "C:\ProgramData\Oracle\Java\javapath" is present in PATH environment variable and contains shortcuts to the java, javaw etc... The target for these shortcuts were all JRE 1.8. (This I think was the main problem) I changed the shortcuts to point to the correct JDK exe's.

Once all of this was done. I opened eclipse all the jdk.tools pom.xml errors disappeared.


I got this problem and it turns out that JBossDevStudio 9.1 on Windows is a 32-bit program. Eclipse, and thus the JBossDevStudio, does not work with the wrong type of JVM. 64-bit eclipse needs a 64-bit JVM, 32-bit eclipse needs a 32-bit JVM. Thus configuring Eclipse to run with my installed 64-bit JDK did not work.

Installing a 32 bit JDK and running Eclipse from that solved the problem.

At least for one of my projects, an other where I had tried to configure a runtime JDK in the Eclipse project properties is still broken.


I solved the problem by uninstalling JRE from my system and leaving JDK only. Reinstall JDK is not enough because Oracle JDK installer installs both JDK and JRE

BTW, it seems to me that this bug is responsible for troubles: java.home of the Eclipse JRE is used instead of the build JRE


In my case, I was executing Maven Build from Eclipse Run Configurations. Even after changing the default JRE configuration to point to JDK installation folder, the issue didn't get fixed for me. The reason is that there is a JRE tab in the Maven Build - Run Configuration (see the image below). And it was still pointing to my JRE installation. I changed it to point to JDK installation and then ran the Maven Build. This time, it worked. enter image description here


Let's understand why this issue happened:

$ mvn -version

Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T20:00:29+01:00) Maven home: C:\Program Files\Apache\maven-3.6.1 Java version: 1.8.0_221, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jre1.8.0_221 Default locale: en_GB, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Maven "mvn -version" command returns above output.

We can see maven gets the java runtime path as "C:\Program Files\Java\jre1.8.0_221" if you don't specify JAVA_HOME environment variable. And then maven assumes this path to be JAVA_HOME. That's why when building the application either from command prompt or any IDE, maven looks for tools.jar file in path "%JAVA_HOME%..\lib\tools.jar".

tools.jar는 JDK 경로에 있으므로 사용하기 전에이를 maven에 언급해야합니다. 이제 며칠 동안 머신은 이미 사용 가능한 jre로 빌드되지만 jdk는 개발에만 필요합니다. 이것이 maven이 jre 경로를 자동으로 선택하는 이유 일 수 있습니다.

더 많은 도움이 필요하면 maven 설치 경로에있는 mvn.cmd 코드를 읽으십시오.


openjdk를 사용하는 경우 openjdk-6-sdk 패키지를 설치해야합니다.


의 상대 위치 ${java.home}/../lib/tools.jar를 작업의 절대 경로로 변경합니다 C:\Program Files\Java\jdk1.6.0_29\lib\tools.jar.

에서 변경해야합니다 playn/pom.xml.

이제 playn-samples의 경우 Vladiator가 맞습니다. 변경할 pom 파일이 너무 많습니다.

참고 URL : https://stackoverflow.com/questions/8375423/missing-artifact-com-suntoolsjar

반응형