Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publish debug & release to artifactory

I'm using Android Studio and desperately trying to get gradle to publish both my debug & release aar's to artifactory with separate repoKeys. Preferably as two separate tasks. I have read this excellent guide, but I don't want to change my gradle file each time in order to deploy.

I can easily create two pom files, but have not managed to make the artifactory plugin dynamic enough to switch my two rep keys.

I feel this is the closest I've come but it's not quite there:

String art_repo = ''

artifactory {
    contextUrl = 'https://www.myjfrogrepo.com'

    publish {
        repository {
            // The Artifactory repository key to publish to
            repoKey = "${art_repo}"

I have then created a custom task which sets the art_repo variable.

task debugPublishTojFrog {
    group "Publishing"
    art_repo = 'libs-snapshot-local'
    art_publicationName = 'debugAar'

    doLast {
        println "Successfully published ${art_repo} to jFrog"
    }
}
debugPublishTojFrog.finalizedBy artifactoryPublish

This responds with the error

Target repository cannot be empty

This leads me to think the repoKey is set at build time and not at run time because my custom task's changes seem to be ignored.

Any suggestions really would be very much appreciated.

like image 742
James Avatar asked May 14 '18 16:05

James


People also ask

What is debug and release?

By default, Debug includes debug information in the compiled files (allowing easy debugging) while Release usually has optimizations enabled. As far as conditional compilation goes, they each define different symbols that can be checked in your program, but they are language-specific macros.

What is difference between debug and release build?

Debug Mode: When we are developing the application. Release Mode: When we are going to production mode or deploying the application to the server. Debug Mode: The debug mode code is not optimized. Release Mode: The release mode code is optimized.

What is publish in .NET core?

dotnet publish compiles the application, reads through its dependencies specified in the project file, and publishes the resulting set of files to a directory. The output includes the following assets: Intermediate Language (IL) code in an assembly with a dll extension. A .

How do I debug a published MVC application?

I Would suggest doing the debugging for ASP.NET MVC Application to follow the below points. Front - End - the developer tool in the browser level for javascript related things. DataBase Side - You can use the SQL profiler to use catch the server-side debugging. Show activity on this post.


1 Answers

A standard way to do this in gradle is to test for the version you are about to publish.

This is exactly what the guide you link to advocates:

repoKey = libraryVersion.endsWith('SNAPSHOT') ? 'libs-snapshot-local' : 'libs-release-local'

What is wrong with this solution?

Edit: If the problem lies with having to change gradle or the gradle.properties file, why not use properties from the command line.

repoKey = project.hasProperty('releaseVersion') ? 'libs-release-local' : 'libs-snapshot-local'

And build your snapshot with

gradle build

And build your release with

gradle build -PreleaseVersion=1.0.0-GA

You can also use this releaseVersion property at several other locations, like your software metadata, your publication information...

like image 150
Arnaud Jeansen Avatar answered Oct 24 '22 06:10

Arnaud Jeansen