简体   繁体   English

IntelliJ运行错误版本的SpringBoot-mvn和Java jar正常工作

[英]IntelliJ running wrong version of SpringBoot - mvn and java jar work correctly

I am running version 2018.1.2 of IntelliJ. 我正在运行IntelliJ的2018.1.2版本。 Whenever I run or debug my application from within IntelliJ, Springboot is running version 2.0.0.RELEASE (and erroring out). 每当我从IntelliJ中运行或调试应用程序时,Springboot就会运行2.0.0.RELEASE版本(并出错)。 The pom.xml has the following set: pom.xml具有以下设置:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.1.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

When I run mvn clean package , I can see that it is running version 2.0.1.RELEASE and everything works as expected. 当我运行mvn clean package ,可以看到它正在运行版本2.0.1.RELEASE,并且一切正常。 I have also tried running java -jar app.jar and it is showing 2.0.1.RELEASE. 我也尝试运行java -jar app.jar ,它显示的是2.0.1.RELEASE。

I have looked all over IntelliJ to see if there are any additional settings or places to override the version and I have found nothing. 我到处看IntelliJ,看看是否还有其他设置或地方可以覆盖该版本,但我什么也没发现。 Does anyone know how to ensure the version of Springboot within IntelliJ? 有谁知道如何确保IntelliJ中的Springboot版本?

I'm not sure what the actual fix is, but I can provide the steps that resolved the issue: 我不确定实际的解决方案是什么,但是我可以提供解决问题的步骤:

  • Backed up and deleted .idea folder and .iml file from project 备份并从项目中删除.idea文件夹和.i​​ml文件
  • Reimported, build (errored immediately) 重新导入,构建(立即出错)
  • Restored .idea folder, but deleted contents of library folder 恢复了.idea文件夹,但删除了库文件夹的内容
  • Reimported, mvn clean package, build (failed immediately) 重新导入,MVN干净的程序包,构建(立即失败)
  • Restored library items 恢复的库项目
  • Build (failed immediately) 构建(立即失败)
  • Mvn clean package, reimport, build (success) MVN清洁包,重新导入,构建(成功)

None of the files or steps really changed, but this process somehow fixed things. 这些文件或步骤都没有真正更改,但是此过程以某种方式固定了某些内容。

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

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