我有我有搖籃建設多項目構建:固定搖籃Artifactory的插件出版發行
myapp/
myapp-client/
myapp-shared/
myapp-server/
build.gradle
settings.gradle
凡settings.gradle
樣子:
include ':myapp-shared'
include ':myapp-client'
include ':myapp-server'
我已經成功地得到了搖籃編譯我Groovy源代碼,運行單元測試,生成GroovyDocs,併爲所有3個子項目打包二進制和源JAR。構建調用爲:gradle clean build groovydoc sourcesJar -Pversion=<whatever version I specify>
。
我現在嘗試添加的搖籃,Artifactory的插件使得:
- 所有3個子項目獲得他們所產生的POM;和
- 所有3個子項目二進制JAR,POM 和源JAR發佈到我的本地運行的Artifactory;和
- 的
artifactoryPublish
任務執行時gradle build
調用
這是我最好的嘗試(我的完整build.gradle
):
allprojects {
buildscript {
repositories {
maven {
url 'http://localhost:8081/artifactory/plugins-release'
credentials {
username = "admin"
password = "password"
}
name = "maven-main-cache"
}
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.0.1"
}
}
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: "com.jfrog.artifactory"
version="0.0.1"
group = "mygroup"
repositories {
mavenCentral()
add buildscript.repositories.getByName("maven-main-cache")
maven {
url "http://localhost:8081/artifactory/mydev-snapshots"
}
}
artifactory {
contextUrl = "http://localhost:8081/artifactory"
publish {
repository {
repoKey = 'mydev-snapshots'
username = "admin"
password = "password"
maven = true
}
defaults {
publications ('mavenJava')
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
}
rootProject {
artifactoryPublish.skip=true
}
subprojects {
apply plugin: 'groovy'
apply plugin: 'eclipse'
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://repository.apache.org/content/repositories/snapshots"
}
maven {
url "http://localhost:8081/artifactory/mydev-snapshots"
}
maven {
url "https://code.google.com/p/guava-libraries/"
}
}
dependencies {
compile (
'org.codehaus.groovy:groovy-all:2.3.7'
)
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
build(dependsOn: 'artifactoryPublish')
}
當我運行gradle clean build groovydoc sourcesJar -Pversion=0.1.1
,我得到了下面的命令行例外:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\myuser\sandbox\eclipse\workspace\myapp\build.gradle' line: 14
* What went wrong:
A problem occurred evaluating root project 'myapp'.
> You can't change a configuration which is not in unresolved state!
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.589 secs
我的問題:發生了什麼事在這裏,我需要做什麼(特別是)來修復它並獲得Artifactory插件發佈?
獎金的問題:。我在兩個地方指定版本號(編譯調用還有build.gradle
文件裏面我想通過構建調用指定版本號只有如何配置artifactoryPublish
(或者說,搖籃,Artifactory的插件)接受我的命令行指定版本
鏈接到多模塊Gradle項目示例不工作:-( –