【发布时间】:2017-12-18 01:24:45
【问题描述】:
我正在开发 ubuntu 16.04,我有一个无法编译的 Eclipse 项目。每次我尝试我都会遇到这个错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5:compile (default-compile) on project TwavoxManager: Fatal error compiling: tools.jar not found: /usr/lib/jvm/java-8-openjdk-amd64/jre/../lib/tools.jar -> [Help 1]
我首先可以毫无问题地编译它,但我必须在我的系统上重新安装 java (openJDK8)。
但问题是 openJDK8 有 JDK + JRE 对吗? 我完全迷失了这里
编辑:添加 pom.xml:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cineapps</groupId>
<artifactId>TwavoxManager</artifactId>
<packaging>jar</packaging>
<name>TwavoxManager</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<!-- COMPILER -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!-- RESOURCES -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
<!-- SHADE -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>TwavoxManager-${project.version}-min</finalName>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>cineapps.TwavoxManager.app.App</mainClass>
</transformer>
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/res</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.54</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.miglayout/miglayout-swing -->
<dependency>
<groupId>com.miglayout</groupId>
<artifactId>miglayout-swing</artifactId>
<version>4.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.3</version>
</dependency>
</dependencies>
<version>1.0</version>
</project>
编辑:有用的屏幕:
【问题讨论】:
-
请分享您的 pom.xml 并将项目特定的 JRE 设置为您的项目
-
@Zia 添加了 pom.xml
-
能否请您修改您的pom中的插件条目,
org.apache.maven.plugins maven-compiler-plugin 3.1 1.8 1.8 -
我现在有这个错误:[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project TwavoxManager: Compilation failure [错误] 此环境中未提供编译器。也许您在 JRE 而不是 JDK 上运行?
-
右击你的项目,Build Path->Configure Build Path。在右侧选项中选择“JRE System Library”选择编辑然后配置你的JDK