Perhaps you are running on a JRE rather than a JDK?如何解决?

HThreePao 2017-11-30 09:58:41
在windows环境下用idea打包项目都是没问题,把项目移到ubuntu里使用mvn clean package docker:build构建镜像报错
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project microservice-discovery-eureka: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

这是java -version的信息
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

这是mvn -version的信息
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /usr/lib/jdk1.7.0_79/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "4.10.0-28-generic", arch: "amd64", family: "unix"

本人对linux不太熟悉,折腾了1天了,希望大神帮助下
...全文
1567 2 点赞 打赏 收藏 举报
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
jklinux 2017-11-30
Perhaps you are running on a JRE rather than a JDK 这句话的意思是你可能仅装好java程序的执行环境,而没有java的开发环境(jdk). 试下安装一个jdk再看了.
  • 打赏
  • 举报
回复
HThreePao 2017-11-30
对了,这是pom,还有个父pom,我觉得pom文件没什么问题
<?xml version="1.0" encoding="UTF-8"?>
<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>
    <artifactId>microservice-discovery-eureka</artifactId>
    <packaging>jar</packaging>

    <parent>
        <groupId>com.zh</groupId>
        <artifactId>microservice-spring-cloud</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.7</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka-server</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
        <plugin>
            <groupId>com.spotify</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>0.4.13</version>
                <configuration>
                    <imageName>zh/${project.artifactId}:${project.version}</imageName>
                    <forceTags>true</forceTags>
                    <baseImage>java</baseImage>
                    <entryPoint>["java","-jar","/${project.build.finalName}.jar"]</entryPoint>
                    <resources>
                        <resource>
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}</include>
                        </resource>
                    </resources>
                </configuration>
        </plugin>
        </plugins>
    </build>
</project>
  • 打赏
  • 举报
回复
相关推荐
发帖
Linux/Unix社区
加入

2.1w+

社区成员

Linux/Unix社区 应用程序开发区
申请成为版主
帖子事件
创建了帖子
2017-11-30 09:58
社区公告
暂无公告