无法载入项目(Netbeans IDE)

umuewwlo  于 2022-11-10  发布在  其他
关注(0)|答案(2)|浏览(287)

我下载了项目的存档,并解压缩它。我把它扔在项目文件夹中,但当我通过Netbeans IDE打开它时-我得到一个错误(项目无法加载)和代码包丢失奇怪的是,在另一台计算机上它打开一个项目没有问题在处理POM时遇到了一些问题:

[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter:jar is missing. @ line 22, column 21
[ERROR] 'dependencies.dependency.version' for org.projectlombok:lombok:jar is missing. @ line 33, column 21
[ERROR] 'dependencies.dependency.version' for org.apache.logging.log4j:log4j-api:jar is missing. @ line 39, column 21
[ERROR] 'dependencies.dependency.version' for org.apache.logging.log4j:log4j-core:jar is missing. @ line 43, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework:spring-core:jar is missing. @ line 54, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework:spring-aspects:jar is missing. @ line 58, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework:spring-context:jar is missing. @ line 62, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework:spring-web:jar is missing. @ line 66, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework:spring-webmvc:jar is missing. @ line 70, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework:spring-orm:jar is missing. @ line 74, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework:spring-tx:jar is missing. @ line 78, column 21
wh6knrhe

wh6knrhe1#

看起来,您复制的项目引用了另一个项目。如果您打开pom.xml,可能会有一个“parent”部分,其中定义了父项目:

<!-- Identifier of the parent project -->
<parent>
    <groupId>...group of your parent project...</groupId>
    <artifactId>... artefactId of your parent project ...</artifactId>
    <version>... version of your parent project ...</version>
</parent

此父项目可能包含具有版本的依赖项。您复制的子模块包含没有版本的依赖项:

<!-- Version of the dependency is defined in parent pom in dependencyManagement section -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <!-- here should be the version -->
</dependency>

您需要同时复制计算机上的父项目,或者手动设置所有依赖项版本。

yvgpqqbh

yvgpqqbh2#

这是一个Sping Boot 项目。要在Netbeans中正确显示该项目,请执行以下操作:

  • 在Netbeans中打开项目
  • Add Maven Central to your list of repositories
  • 右键单击项目并运行Build。
  • 在构建过程中,工件spring-boot-starter-parent被下载到您的本地maven资源库中,现在Netbeans可以正确地显示项目。

相关问题