我是 gradle 和 Artifactory 集成的新手,到目前为止,我可以将工件从一个工作区发布到另一个工作区。
我所做的是创建了一个 gradle 示例项目,现在我想将 JUnit jar 发布到 Artifactory 中,然后将其作为依赖项检索到我的项目类路径中,以便我可以运行我的项目。
项目结构
构建.gradle
apply plugin: 'java'
apply plugin: 'eclipse'
//apply plugin: 'artifactory-publish'
sourceCompatibility = 1.5
version = '1.0'
jar
{
manifest
{
attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation Version': version
}
}
buildscript
{
repositories
{
maven
{
url 'http://dl.bintray.com/jfrog/jfrog-jars'
}
mavenCentral()
}
dependencies
{
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.1.0')
}
}
//pull/retrieve artifacts(jar) from artifactory
repositories
{
ivy
{
url = 'http://localhost:8081/artifactory/APM-jars'
credentials
{
username = 'admin'
password = 'password'
}
}
mavenCentral()
dependencies {
compile group: 'jakarta-regexp', name: 'jakarta-regexp', version: '1.+'
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
testCompile group: 'junit', name: 'junit', version: '4.+'
}
}
test {
systemProperties 'property': 'value'
}
///publish/upload artifact (jar) into 3 different type of builds
uploadArchives
{
repositories
{
//Just copy to a directory
//flatDir
//{
//dirs 'repos2'
//}
//Publish to an Ivy repository in Artifactory.
ivy
{
url = 'http://localhost:8081/artifactory/test-ivy'
credentials
{
username = 'admin'
password = 'password'
}
}
//Publish to a Gradle repository in Artifactory.
ivy
{
url = 'http://localhost:8081/artifactory/test-gradle'
credentials
{
username = 'admin'
password = 'password'
}
//layout 'gradle'
layout 'pattern',
{
artifact '[module]/[revision]/[artifact](.[ext])'
ivy '[module]/[revision]/ivy.xml'
}
}
//Publish to a Maven repository in Artifactory.
ivy
{
url = 'http://[host]:port/artifactory/test-maven'
credentials
{
username = 'admin'
password = 'password'
}
layout 'maven'
}
}
}