artifactory的这里是我的build.gradle
:出版两个罐子和来源罐子从摇篮
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: 'codenarc'
apply plugin: 'maven-publish'
apply plugin: "com.jfrog.artifactory"
version="0.0.2"
group = "mylib"
repositories {
mavenCentral()
add buildscript.repositories.getByName("maven-main-cache")
maven {
url "http://localhost:8081/artifactory/myapp-snapshots"
}
}
dependencies {
compile 'commons-validator:commons-validator:1.4.0'
testCompile 'junit:junit:4.11'
}
artifactory {
contextUrl = "http://localhost:8081/artifactory"
publish {
repository {
repoKey = 'myorg-snapshots'
username = "admin"
password = "password"
maven = true
}
defaults {
publications ('mavenJava')
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
task dist(type: Zip, dependsOn: build) {
classifier = 'buildreport'
from('build/test-results') {
include '*.xml'
into 'tests'
}
from('build/reports/codenarc') {
into 'reports'
}
from('build/docs') {
into 'api'
}
from(sourcesJar) {
into 'source'
}
from('build/libs') {
exclude '*-sources.jar'
into 'bin'
}
}
在此基础上的当前设置:
- 要建立我的JAR我要运行
gradle clean build groovydoc sourcesJar dist
然后 - 要发布到Artifactory,我必须运行第二个命令
gradle artifactoryPublish
两件事情我期待在这里改变:
gradle artifactoryPublish
只出版我的建JAR和动态创建的POM来artifactory的。我希望它也发布我的版本创建的源JAR。 如何?;和- 理想情况下,我希望能够通过调用
gradle publish
来完成上述所有操作,而不是必须按顺序运行2个命令。 这可能吗?如果是这样,怎么样?
请参阅我的答案,请让我知道它是否工作。 – Opal 2015-05-30 08:29:27