Micronaut-Shadow Fat-jar插件不适用于公司回购 [英] Micronaut - shadow fat-jar plugin not working with corporate repo
问题描述
我正在为项目使用 Micronaut 框架,并且Micronaut CLI会生成项目使用com.github.johnrengelman.shadow
gradle 插件,当我使用-
I am using Micronaut framework for a project and Micronaut CLI generates project with com.github.johnrengelman.shadow
gradle plugin which works fine when I run the jar using-
$ java -Dmicronaut.environments=E1 -jar build/appBundle/app.jar
build.gradle -
plugins {
id "com.github.johnrengelman.shadow" version "5.0.0"
}
...
shadowJar {
mergeServiceFiles()
}
问题是com.github.johnrengelman.shadow
插件由于某种原因无法与Jenkins配合使用,我怀疑它在我们的公司存储库中不可用(并且无法添加).虽然我可以使用java
插件的jar
任务创建可执行文件fat-jar,但它失败并显示以下错误-
The issue is that com.github.johnrengelman.shadow
plugin is not working with Jenkins for some reason and I am suspecting that it's not available in our corporate repo(and can't be added). While I am able to create an executable fat-jar using jar
task of java
plugin, it fails with following error-
$ 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) }
}
}
主要问题是为什么com.github.johnrengelman.shadow
插件不能与公司存储库一起使用?
Primary ask is why wouldn't com.github.johnrengelman.shadow
plugin work with a corporate repository?
推荐答案
已解决
问题是插件{...}块无法访问私有/公司存储库.
The issue was that plugin{...} block doesn't access private/corporate repo.
通过将插件定义从plugins{...}
还原为apply plugin...
Solved it by reverting plugin definition from plugins{...}
to older way of definition which is apply plugin...
添加了应用插件的较旧方法(这是使其与私有存储库一起使用的唯一方法)-
apply plugin: "com.github.johnrengelman.shadow"
已删除(无法访问私人/公司存储库)-
plugins {
id "com.github.johnrengelman.shadow"
}
有关更多信息,请查看此 SO问题中的第一条评论.
For more info, checkout first comment in this SO question.
这篇关于Micronaut-Shadow Fat-jar插件不适用于公司回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!