What you need:
- Artifactory
- A Gradle sample called "Java Quickstart" (part of the main Gradle download, not a separate download)
What is assumed
- Artifactory is installed at its factory default port 8081
- Artifactory's pre-configured "admin" user's password is "password" (default)
Steps
1. Create a copy of Java Quickstart
2. Open build.gradle file and replace the content with the gradle script in the following:
buildscript {
repositories {
maven {
url 'http://localhost:8081/artifactory/plugins-release'
credentials {
username = "admin"
password = "password"
}
}
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.0.9')
}
}
apply plugin: 'java'
apply plugin: 'artifactory'
apply plugin: 'maven'
sourceCompatibility = 1.5
version = '1.0.2'
group = 'test.quickstart'
jar {
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version': version
}
}
dependencies {
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
}
artifactory {
contextUrl = "http://localhost:8081/artifactory" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'libs-release-local'
username = "admin"
password = "password"
maven = true
}
}
resolve {
repository {
repoKey = 'libs-release'
username = "admin"
password = "password"
maven = true
}
}
}
3. At command prompt, run $ gradle artifactoryPublish
4. Verify that Quickstart.jar file is added to artifactory by checking localhost:8081
Done.
0 件のコメント:
コメントを投稿