当我试图将生成的jar文件安装到本地Maven仓库时,遇到了问题。错误信息显示“未找到任务'publish'”。
我正在使用以下Gradle脚本:
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'
}
你知道我为什么要读这个错误信息吗?谢谢。
更新
按照@RaGe所说的运行命令解决了问题:
gradle publishToMavenLocal
gradle publishToMavenLocal
,该命令将把项目发布到本地的 Maven 仓库。 - RaGemaven
жҸ’件гҖӮmaven-publish
жҸ’件еңЁжҹҗдәӣж–№йқўиҝӣиЎҢдәҶжӣҙж”№гҖӮ - RaGetask install(dependsOn: publishToMavenLocal)
。 - Eric Wendelinapply plugin:'maven'
和gradle install
? - Alex78191