Gradle 4.7,Boot插件v2.0.2.RELEASE,使用Maven插件发布
要自定义工件的名称,需要执行以下操作:
jar {
archiveName "citylist-builder.jar"
}
bootJar {
archiveName "citylist-builder.jar"
}
如果上述配置不匹配,./gradlew clean build install
则会失败并显示如下消息:
* What went wrong:
Execution failed for task ':my-project:install'.
> Could not publish configuration 'archives'
> Cannot publish artifact '<archiveName in bootJar>.jar' (/path/to/my-project/build/libs/my-project-2.11.0-beta-SNAPSHOT.jar) as it does not exist.
由于boorJar
任务的类型是Jar
,我们不需要重复配置。