这个工程打包怎么报错呢?

这个工程打包怎么报错呢?

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.imoc</groupId>
    <artifactId>Autothree</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>Autothree</name>
    <description>Autothree</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        
 
        
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>28.2-android</version>
        </dependency>

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.38</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.9.2</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.14</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.9.2</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>1.3.0</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.12</version>
        </dependency>

    </dependencies>
    <repositories>
        <repository>
            <id>aliyun</id>
            <name>aliyun</name>
            <url>https://maven.aliyun.com/repository/public</url>
        </repository>
    </repositories>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <mainClass>com.imoc.autothree.AutothreeApplication</mainClass>
                </configuration>

            </plugin>

        </plugins>
    </build>

</project>

Windows PowerShell

版权所有 (C) Microsoft Corporation。保留所有权利。


尝试新的跨平台 PowerShell https://aka.ms/pscore6  


PS D:\java_code\Autothree> mvn clean package

[INFO] Scanning for projects...

[INFO] 

[INFO] -------------------------< com.imoc:Autothree >-------------------------

[INFO] Building Autothree 0.0.1-SNAPSHOT

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

[INFO] 

[INFO] --- maven-clean-plugin:3.2.0:clean (default-clean) @ Autothree ---

[INFO] Deleting D:\java_code\Autothree\target

[INFO] 

[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ Autothree ---

[INFO] Using 'UTF-8' encoding to copy filtered resources.

[INFO] Using 'UTF-8' encoding to copy filtered properties files.

[INFO] Copying 1 resource

[INFO] Copying 3 resources

[INFO] 

[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ Autothree ---

[INFO] Changes detected - recompiling the module!

[INFO] Compiling 4 source files to D:\java_code\Autothree\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:  1.626 s

[INFO] Finished at: 2022-05-23T15:09:36+08:00

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

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project Autothree: Compilation failure

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

[ERROR]

[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

PS D:\java_code\Autothree> 


正在回答

登陆购买课程后可参与讨论,去登陆

2回答

同学你好,1、可能是同学插件版本的问题,或依赖版本的原因,建议同学调整插件版本。

2、也有可能是源代码的问题,建议同学使用课程代码打包试一下。

祝学习愉快!

好帮手慕小尤 2022-05-23 16:35:07

同学你好,1、建议同学设置jdk版本为1.8

    1)在 Java Build Path的libraries中修改对应的JDK版本为1.8;

    2)在Java Compiler 中修改对应的JDK版本为1.8;

    3)在Project Facet中修改对应的JDK版本为1.8;

2、如果还存在问题,建议添加下方内容,设置版本号,并添加jdk版本试一下。如下所示:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
    </configuration>
</plugin>

祝学习愉快!

  • 提问者 热爱编程学习 #1

    Windows PowerShell

    版权所有 (C) Microsoft Corporation。保留所有权利。


    尝试新的跨平台 PowerShell https://aka.ms/pscore6


    PS D:\java_code\Autothree> mvn clean package

    [INFO] Scanning for projects...

    [INFO] 

    [INFO] -------------------------< com.imoc:Autothree >-------------------------

    [INFO] Building Autothree 0.0.1-SNAPSHOT

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

    [INFO] 

    [INFO] --- maven-clean-plugin:3.2.0:clean (default-clean) @ Autothree ---

    [INFO] Deleting D:\java_code\Autothree\target

    [INFO] 

    [INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ Autothree ---

    [INFO] Using 'UTF-8' encoding to copy filtered resources.

    [INFO] Using 'UTF-8' encoding to copy filtered properties files.

    [INFO] Copying 1 resource

    [INFO] Copying 3 resources

    [INFO] 

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

    [INFO] Changes detected - recompiling the module!

    [INFO] Compiling 4 source files to D:\java_code\Autothree\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:  1.213 s

    [INFO] Finished at: 2022-05-23T20:19:06+08:00

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

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

    [ERROR]

    [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

    PS D:\java_code\Autothree> mvn clean package

    [INFO] Scanning for projects...

    [INFO] 

    [INFO] -------------------------< com.imoc:Autothree >-------------------------

    [INFO] Building Autothree 0.0.1-SNAPSHOT

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

    [INFO] 

    [INFO] --- maven-clean-plugin:3.2.0:clean (default-clean) @ Autothree ---

    [INFO] Deleting D:\java_code\Autothree\target

    [INFO] 

    [INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ Autothree ---

    [INFO] Using 'UTF-8' encoding to copy filtered resources.

    [INFO] Using 'UTF-8' encoding to copy filtered properties files.

    [INFO] Copying 1 resource

    [INFO] Copying 3 resources

    [INFO] 

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

    [INFO] Changes detected - recompiling the module!

    [INFO] Compiling 4 source files to D:\java_code\Autothree\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:  1.161 s

    [INFO] Finished at: 2022-05-23T20:25:11+08:00

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

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

    [ERROR]

    [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

    PS D:\java_code\Autothree> mvn clean package

    [INFO] Scanning for projects...

    [INFO] 

    [INFO] -------------------------< com.imoc:Autothree >-------------------------

    [INFO] Building Autothree 0.0.1-SNAPSHOT

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

    [INFO] 

    [INFO] --- maven-clean-plugin:3.2.0:clean (default-clean) @ Autothree ---

    [INFO] Deleting D:\java_code\Autothree\target

    [INFO] 

    [INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ Autothree ---

    [INFO] Using 'UTF-8' encoding to copy filtered resources.

    [INFO] Using 'UTF-8' encoding to copy filtered properties files.

    [INFO] Copying 1 resource

    [INFO] Copying 3 resources

    [INFO]

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

    [INFO] Changes detected - recompiling the module!

    [INFO] Compiling 4 source files to D:\java_code\Autothree\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:  1.505 s

    [INFO] Finished at: 2022-05-23T20:37:19+08:00

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

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Autothree: Compilation failure

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

    [ERROR]

    [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

    PS D:\java_code\Autothree> 


    2022-05-23 20:37:30
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师