使用Gradle将Java工件发布到Maven Local [英] Publish Java artifact to Maven Local with Gradle
本文介绍了使用Gradle将Java工件发布到Maven Local的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试将生成的jar安装到本地Maven存储库时遇到问题.消息错误只是显示我未找到任务'发布'"
I am facing a problem when trying to install a generated jar into my local Maven Repository. The message error just show me 'task 'publish' is not found'
我正在使用此Gradle脚本:
I am using this Gradle Script:
buildscript {
ext {
springBootVersion = '1.3.2.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'maven-publish'
jar {
baseName = 'mongofoundry'
version = '1.0.0'
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-data-mongodb')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.9'
}
您知道为什么我要阅读该错误消息吗? 谢谢.
Do you have some idea Why I am reading that error message? Thanks.
已更新
按照@RaGe所述运行命令,解决了该问题:
Running the command as @RaGe mentioned, solved the problem:
gradle publishToMavenLocal.
推荐答案
将工件发布到本地Maven的正确任务是
The correct task to publish artifacts to local maven is
gradle publishToMavenLocal
这篇关于使用Gradle将Java工件发布到Maven Local的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文