简体   繁体   English

mvn包因新的SpringBoot项目而失败

[英]mvn package fails with new SpringBoot project

I just downloaded the default SpringBoot project with default settings from the initilizizer : 我刚刚下载从默认设置的默认SpringBoot项目initilizizer

Here's my codebase after several test codes: 这是我经过几个测试代码的代码库:
I had no problem with rest api, thymeleaf but I failed with JPA. 我的休息api,百里香叶没有问题,但JPA失败了。

Build fails: 构建失败:

package javax.persistance does not exist
cannot find symbol [ERROR]   symbol: class Entity

It failed just after adding entity annotation, nothing else: 添加实体批注后,它失败了,其他一切:

I really like Java. 我真的很喜欢Java。 I can't tell you how I want to learn this language ...and I believe that I can be successful with the syntax, I can understand the tutorials. 我无法告诉您我想如何学习这种语言 ...而且我相信使用语法可以成功,我可以理解教程。 This is my only serious problem before moving forward. 这是我前进之前唯一的严重问题。

My configuration: 我的配置:

Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T21:41:47+03:00)
Maven home: C:\ProgramData\chocolatey\lib\maven\apache-maven-3.6.0\bin\..
Java version: 1.8.0_191, vendor: Oracle Corporation, runtime: C:\Program 
Files\Java\jdk1.8.0_191\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

IDE: Spring Tool Suite 4 IDE:Spring工具套件4

Did you import package manually ? 您是否手动导入软件包? It should be as below in your User.java 它应该在您的User.java如下所示

import javax.persistence.Entity;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM