发生了一个错误,在使用Maven打包Spring Boot应用程序时。

huangapple go评论102阅读模式
英文:

Occurred an error while packaging spring-boot application by maven

问题

以下是您要求的翻译内容:

The IDEA应用程序告诉我,在打包我的easy-start spring-boot应用程序时,出现了以下错误:Invalid packaging for parent POM org.springframework.boot:spring-boot-starter-web:1.5.9.RELEASE,必须是“pom”,但实际是“jar”。如何解决这个问题?
我的操作系统是macOS 10.15.7,安装了三个JDK(1.8、11、14),我正在使用maven-3.6.3,我的maven设置也已更改为JDK 1.8和11。
以下是pom.xml文件的内容:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <modelVersion>4.0.0</modelVersion>
  6. <groupId>org.example</groupId>
  7. <artifactId>SpringBoot-01-HelloWorld</artifactId>
  8. <version>1.0</version>
  9. <packaging>pom</packaging>
  10. <parent>
  11. <artifactId>spring-boot-starter-web</artifactId>
  12. <groupId>org.springframework.boot</groupId>
  13. <version>1.5.9.RELEASE</version>
  14. </parent>
  15. <dependencies>
  16. <dependency>
  17. <groupId>org.springframework.boot</groupId>
  18. <artifactId>spring-boot-starter-web</artifactId>
  19. </dependency>
  20. </dependencies>
  21. <build>
  22. <plugins>
  23. <plugin>
  24. <groupId>org.springframework.boot</groupId>
  25. <artifactId>spring-boot-maven-plugin</artifactId>
  26. </plugin>
  27. </plugins>
  28. </build>
  29. </project>
英文:

The IDEA app told me that Invalid packaging for parent POM org.springframework.boot:spring-boot-starter-web:1.5.9.RELEASE, must be &quot;pom&quot; but is &quot;jar&quot; while I packaged my easy-start spring-boot application, how to solve this problem?
My platform is macOS 10.15.7 with 3 JDKs(1.8, 11, 14), and I am using maven-3.6.3, my maven settings are also changed the JDK to 1.8 and 11
The pom.xml file is as followed:

  1. &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  2. &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
  3. xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  4. xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
  5. &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  6. &lt;groupId&gt;org.example&lt;/groupId&gt;
  7. &lt;artifactId&gt;SpringBoot-01-HelloWorld&lt;/artifactId&gt;
  8. &lt;version&gt;1.0&lt;/version&gt;
  9. &lt;packaging&gt;pom&lt;/packaging&gt;
  10. &lt;parent&gt;
  11. &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
  12. &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  13. &lt;version&gt;1.5.9.RELEASE&lt;/version&gt;
  14. &lt;/parent&gt;
  15. &lt;dependencies&gt;
  16. &lt;dependency&gt;
  17. &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  18. &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
  19. &lt;/dependency&gt;
  20. &lt;/dependencies&gt;
  21. &lt;build&gt;
  22. &lt;plugins&gt;
  23. &lt;plugin&gt;
  24. &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  25. &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
  26. &lt;/plugin&gt;
  27. &lt;/plugins&gt;
  28. &lt;/build&gt;
  29. &lt;/project&gt;

答案1

得分: 1

以下是您要翻译的内容:

父 POM 应该是 Spring Boot 的父项目

  1. <parent>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-parent</artifactId>
  4. <version>1.5.9.RELEASE</version>
  5. </parent>
英文:

The parent POM should be the Spring Boot parent project

  1. &lt;parent&gt;
  2. &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
  3. &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
  4. &lt;version&gt;1.5.9.RELEASE&lt;/version&gt;
  5. &lt;/parent&gt;

huangapple
  • 本文由 发表于 2020年10月15日 19:32:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/64370660.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定