Deploying external zip file to artifactory


(mehow6) #1

Hi all, I’ve a huge problem which I’m afraid I’m not able to resolve. I’m quite new to gradle and have problem with exporting .zip file to artifactory. When I type ‘gradle artifactoryPublish’ everything goes fine, zip file is deployed to artifactory but it has groupId as null and version as ‘unspecified’ and path to zip is a little bit strange and finally zip name is: null-unspecified.zip what is more than unacceptable. How can I define these values? Let me show my script:

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.1.0’)

} }

configurations { [archives] }

allprojects {

apply plugin: ‘artifactory’ }

(…)

artifacts {

archives buildPackage //where build package prepares my .ZIP file }

artifactory {

contextUrl = “http://localhost:8081/artifactory

publish {

repository {

repoKey = ‘libs-release-local’

username = “admin”

password = “password”

maven = true

}

}

resolve {

repository {

repoKey = ‘libs-release’

username = “admin”

password = “password”

maven = true

}

} }


(Gary Hale) #2
group = "some.group"
version = "1.0.0"

These are properties of the project itself.


(mehow6) #3

Hi Gary, thank you for your quick reply. It is almost fine, but still has something I want to fix. Please notice what was generated:

http://localhost:8081/artifactory/libs-release-local/some/group/app-build/1.0.0/null-1.0.0.zip

So, I would like to fix two things here: - still have null in front of files name - I would like to customize app-build and set it to something else

Thanks in advance


(mehow6) #4

Only one problem remaining…

Ok, I’ve defined project name using external script called settings.gradle with code:

rootProject.name = "myProjectName"

It works fine, but I’ve still problem with this ‘null’ value in front of zip files name. Any ideas? :slight_smile:


(Gary Hale) #5

I assume buildPackage is a Zip task? If so, does it have a baseName set up? Something like:

buildPackage {
  baseName = project.name
}

As far as controlling the module name (app-build) that is keyed off of the name of the directory. To set it to something else, I think you would have to use a settings.gradle file. Your settings.gradle would look something like this:

rootProject.name = "myNewModuleName"

(Gary Hale) #6

What name does it produce for the zip file in build/distributions? Is it also null-1.0.0.zip? If so, then it has something to do with the naming of the file in the zip task (see my last reply). If not, then I’m not sure - might be an issue with the artifactory plugin (which I’m not intimately familiar with).


(mehow6) #7

Thanks! It works, baseName did the job.