老师帮忙看下,打包时报错

来源:2-6 项目打包

慕婉清2005302

2020-11-23 01:49:11

# 具体遇到的问题
打包时出错
# 报错信息的截图

[INFO] Scanning for projects...

[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/2.5.5/maven-assembly-plugin-2.5.5.pom

[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/2.5.5/maven-assembly-plugin-2.5.5.pom (17 kB at 3.5 kB/s)

[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/2.5.5/maven-assembly-plugin-2.5.5.jar

[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/2.5.5/maven-assembly-plugin-2.5.5.jar (238 kB at 8.0 kB/s)

[INFO] 

[INFO] ----------------------< com.imooc:maven-first_1 >-----------------------

[INFO] Building maven-first_1 1.0.0-RELEASE

[INFO] --------------------------------[ jar ]---------------------------------

[INFO] 

[INFO] >>> maven-assembly-plugin:2.5.5:assembly (default-cli) > package @ maven-first_1 >>>

[INFO] 

[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-first_1 ---

[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!

[INFO] Copying 0 resource

[INFO] 

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven-first_1 ---

[INFO] Changes detected - recompiling the module!

[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!

[INFO] Compiling 1 source file to D:\eclipse\workspace\maven-first_1\target\classes

[INFO] -------------------------------------------------------------

[ERROR] COMPILATION ERROR : 

[INFO] -------------------------------------------------------------

[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

[INFO] 1 error

[INFO] -------------------------------------------------------------

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time:  40.202 s

[INFO] Finished at: 2020-11-23T01:41:17+08:00

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project maven-first_1: 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


# 相关课程内容截图

# 尝试过的解决思路和结果

# 粘贴全部相关代码,切记添加代码注释(请勿截图)

<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>com.imooc</groupId>

<artifactId>maven-first_1</artifactId>

<version>1.0.0-RELEASE</version>

<repositories>

  <repository>

    <!-- 创建私服的地址 -->

    <id>aliyun</id>

    <name>aliyun</name>

    <url>https://maven.aliyun.com/repository/public</url>

  </repository>

</repositories>

<dependencies>

<dependency>

<groupId>mysql</groupId>

<artifactId>mysql-connector-java</artifactId>

<version>8.0.22</version>

</dependency>

<dependency>

<groupId>com.belerweb</groupId>

<artifactId>pinyin4j</artifactId>

<version>2.5.1</version>

</dependency>

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-webmvc</artifactId>

<version>5.3.1</version>

</dependency>

</dependencies>

<build>

  <!-- 配置插件 -->

  <plugins>

      <plugin>

          <groupId>org.apache.maven.plugins</groupId>

          <artifactId>maven-assembly-plugin</artifactId>

          <version>2.5.5</version>

          <configuration>

              <archive>

                  <manifest>

                      <mainClass>com.imooc.maven.PinyinTestor</mainClass>

                  </manifest>

              </archive>

              <descriptorRefs>

                  <!-- all in one,在打包时会将所有引用的jar,合并到输出的jar文件中 -->

                  <descriptorRef>jar-with-dependencies</descriptorRef>

              </descriptorRefs>

          </configuration>

      </plugin>

  </plugins>

</build>

</project>


写回答

1回答

好帮手慕小班

2020-11-23

同学你好,根据贴出的报错信息:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?-->在这个环境中没有提供编译器。也就是说并没有配置jdk目录。

同学可以参考如下配置:

        进入 Window > Preferences > Java > Installed JREs ->Add ->Standard VM     选择jdk安装目录,添加应用。

http://img.mukewang.com/climg/5fbb35c609519fff10340505.jpg

然后,右键项目build path,将刚才配置的JDK添加到项目中

http://img.mukewang.com/climg/5fbb35dc0912fa4310520413.jpg

http://img.mukewang.com/climg/5fbb35e709a14dd507440396.jpg

如上修改后,再来尝试一下。
0

0 学习 · 16556 问题

查看课程