Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Spring Boot';时出现无效的打包错误;s starter web父级_Spring_Maven_Spring Boot_Kotlin - Fatal编程技术网

使用Spring Boot';时出现无效的打包错误;s starter web父级

使用Spring Boot';时出现无效的打包错误;s starter web父级,spring,maven,spring-boot,kotlin,Spring,Maven,Spring Boot,Kotlin,我想在我的项目中使用springbootstarterwebparent。不幸的是,如果我尝试使用它,我会收到以下错误消息: [ERROR] [ERROR] Some problems were encountered while processing the POMs: [ERROR] Invalid packaging for parent POM org.springframework.boot:spring-boot-starter-web:2.0.5.RELEASE, must be

我想在我的项目中使用
springbootstarterweb
parent。不幸的是,如果我尝试使用它,我会收到以下错误消息:

[ERROR] [ERROR] Some problems were encountered while processing the POMs: [ERROR] Invalid packaging for parent POM org.springframework.boot:spring-boot-starter-web:2.0.5.RELEASE, must be "pom" but is "jar" @ org.springframework.boot:spring-boot-starter-web:2.0.5.RELEASE @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project com.company:my-artifact:1.0-SNAPSHOT (/home/user/Projects/my-artifact/pom.xml) has 1 error [ERROR] Invalid packaging for parent POM org.springframework.boot:spring-boot-starter-web:2.0.5.RELEASE, must be "pom" but is "jar" @ org.springframework.boot:spring-boot-starter-web:2.0.5.RELEASE 该项目是一个使用IntelliJ创建的Kotlin项目,通过从archetype创建一个新的Maven项目,并选择Kotlin作为JVM原型,因此我仅有的文件是
pom.xml
src/main/Kotlin/com/company/Hello.kt
,内容如下:

package com.company

fun main(args: Array<String>) {
    println("Hello, World")
}

据我所知,我的POM是正确的。我多次尝试
mvn清理构建
,但下载的依赖项似乎没有问题。
springbootstarterweb
不应该用作父级吗

您必须将
spring boot starter父级
设置为父级

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.5.RELEASE</version>
</parent>

我建议使用

中的“Spring Boot Reference Guide”(春季开机参考指南)。我想我必须更改我所遵循的指南。如果我的答案解决了您的问题,请不要忘记接受答案(绿色检查)
package com.copmany

import org.junit.Test
import kotlin.test.assertEquals

class HelloTest {

}
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.5.RELEASE</version>
</parent>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib-jdk8</artifactId>
        <version>${kotlin.version}</version>
    </dependency>
</dependencies>