我在我的应用程序中使用dropwizard,并且尝试运行JAR文件,它显示了以下错误:
Could not resolve type id 'http' as a subtype of [simple type, class io.dropwizard.jetty.ConnectorFactory]
我的config.yml文件
server:
type: default
applicationConnectors:
- type: http
port: 9000
adminConnectors:
- type: http
port: 9001
另外,我已经在build.gradle中处理了影子插件,但仍然显示错误。
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.github.jengelman.gradle.plugins:shadow:2.0.1"
}
}
apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
sourceCompatibility = 1.8
mainClassName = "com.freightos.flux.LocationsApplication"
repositories {
jcenter()
mavenCentral()
}
task wrapper(type: Wrapper) {
gradleVersion = "4.5"
}
// Configure the shadow jar task
shadowJar {
mergeServiceFiles()
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
}
jar {
manifest {
attributes 'Main-Class': mainClassName
}
}
我该如何解决这个问题?
最佳答案
您的YAML缩进看起来很破损。 linter为此返回它:
server:
adminConnectors:
-
port: 9001
type: http
applicationConnectors:
-
port: 9000
type: http
type: default
尝试以下方法:
server:
type: default
applicationConnectors:
- type: http
port: 8080
adminConnectors:
- type: http
port: 8081
- type: https