github.com/jfrog/jfrog-cli-core/v2@v2.52.0/tests/testdata/gradle-example-config/build.gradle (about) 1 /* 2 * Copyright (C) 2013 JFrog Ltd. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 buildscript { 18 repositories { 19 mavenCentral() 20 } 21 dependencies { 22 classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4+') 23 } 24 configurations.classpath { 25 resolutionStrategy { 26 cacheDynamicVersionsFor 0, 'seconds' 27 cacheChangingModulesFor 0, 'seconds' 28 } 29 } 30 } 31 32 33 def javaProjects() { 34 subprojects.findAll { new File(it.projectDir, 'src').directory } 35 } 36 37 allprojects { 38 apply plugin: 'com.jfrog.artifactory' 39 group = 'org.jfrog.test.gradle.publish' 40 version = currentVersion 41 status = 'Integration' 42 repositories { 43 mavenCentral() 44 } 45 } 46 47 // Setting this property to true will make the artifactoryPublish task 48 // skip this module (in our case, the root module): 49 artifactoryPublish.skip = true 50 51 project('services') { 52 artifactoryPublish.skip = true 53 } 54 55 configure(javaProjects()) { 56 apply plugin: 'java' 57 apply plugin: 'maven-publish' 58 59 dependencies { 60 testImplementation 'junit:junit:4.7' 61 } 62 63 publishing { 64 publications { 65 mavenJava(MavenPublication) { 66 from components.java 67 artifact(file("$rootDir/gradle.properties")) 68 } 69 } 70 } 71 } 72 73 project('api') { 74 apply plugin: 'ivy-publish' 75 76 publishing { 77 publications { 78 ivyJava(IvyPublication) { 79 from components.java 80 artifact(file("$rootDir/settings.gradle")) { 81 name "gradle-settings" 82 extension "txt" 83 type "text" 84 } 85 // The config below will add a extra attribute to the ivy.xml 86 // See http://ant.apache.org/ivy/history/latest-milestone/concept.html#extra 87 descriptor.withXml { 88 asNode().info[0].attributes().put('e:architecture', 'amd64') 89 } 90 } 91 } 92 } 93 94 artifactoryPublish { 95 publications(publishing.publications.ivyJava) 96 properties { 97 simpleFile '**:**:**:*@*', simpleFile: 'only on settings file' 98 } 99 } 100 } 101 102 artifactory { 103 clientConfig.setIncludeEnvVars(true) 104 clientConfig.info.addEnvironmentProperty('test.adding.dynVar',new java.util.Date().toString()) 105 106 contextUrl = 'http://127.0.0.1:8081/artifactory' 107 publish { 108 repository { 109 repoKey = 'libs-snapshot-local' // The Artifactory repository key to publish to 110 username = "${artifactory_user}" // The publisher user name 111 password = "${artifactory_password}" // The publisher password 112 // This is an optional section for configuring Ivy publication (when publishIvy = true). 113 ivy { 114 ivyLayout = '[organization]/[module]/ivy-[revision].xml' 115 artifactLayout = '[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]' 116 mavenCompatible = true //Convert any dots in an [organization] layout value to path separators, similar to Maven's groupId-to-path conversion. True if not specified 117 } 118 } 119 defaults { 120 // Reference to Gradle publications defined in the build script. 121 // This is how we tell the Artifactory Plugin which artifacts should be 122 // published to Artifactory. 123 publications('mavenJava') 124 publishArtifacts = true 125 // Properties to be attached to the published artifacts. 126 properties = ['qa.level': 'basic', 'dev.team' : 'core'] 127 publishPom = true // Publish generated POM files to Artifactory (true by default) 128 publishIvy = true // Publish generated Ivy descriptor files to Artifactory (true by default) 129 } 130 } 131 }