最初是通过公司回购设置新的Micronaut项目的障碍,现在更多地是关于如何引导嵌入式服务器的好奇心。我有一个Micronaut CLI生成的项目,该项目带有com.github.johnrengelman.shadow
gradle 插件,当我使用-
$ java -Dmicronaut.environments=E1 -jar build/appBundle/app.jar
build.gradle -
plugins {
id "com.github.johnrengelman.shadow" version "5.0.0"
}
...
shadowJar {
mergeServiceFiles()
}
当我将shadow
插件/任务替换为jar
任务和java
插件时,便可以创建可执行文件fat-jar,但失败并出现以下错误->
$ java -Dmicronaut.environments=E1 -jar build/appBundle/app.jar
16:12:22.662 [main] INFO i.m.context.env.DefaultEnvironment - Established active environments: [E1]
16:12:22.863 [main] INFO io.micronaut.runtime.Micronaut - No embedded container found. Running as CLI application
build.gradle -
plugins {
id "java"
}
...
jar {
manifest {
attributes "Main-Class": "axp.payments.pci.dss.PaymentsPciDssDispatcher"
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
fat-jar
gradle插件的情况下使用嵌入式Netty服务器创建com.github.johnrengelman.shadow
?