Is there a replacement for publishPermissions on an upload?


(richard murray) #1

Hi, I’ve just upgraded from gradle-1.0-milesone-3 to gradle-1-0 (great performance improvement by the way!). In my upload tasks (to an Ivy repository) I was setting the file permissions as follows:

//upload jar to Ivy repository
uploadArchives {
    repositories {
        add project.repositories.test_repo { publishPermissions = '0777' }
    }
}

When I run this against gradle-1.0 the publishPermissions property has been deprecated. Is there an alternative way to do this in 1.0?


#2

In Gradle 1.0, we have started to move away from exposing Ivy classes in our API. This will make it easier for us to continue to improve dependency management in the future.

The value of ‘project.repositories.test_repo’ is no longer an Ivy DependencyResolver instance, and so does not have a ‘publishPermissions’ property that you can set.

Your best bet is probably to set this property when creating the repository:

  • What does your ‘repositories’ block look like, where ‘test_repo’ is defined? * Do you need to specify different permissions for different publish configurations?

(richard murray) #3

Our repository block is like this:

repositories {
                  add(new org.apache.ivy.plugins.resolver.SshResolver()) {
            name = 'test_repo'
            user = 'xxx'
            userPassword = 'xxx'
            addIvyPattern
    "/uwm/ivy-repo/[organisation]/[module]/ivys/ivy-[revision].xml"
            addArtifactPattern "/uwm/ivy-repo/[organisation]/[module]/[type]s/[artifact]-[revision](-[classifier]).[ext]"
            host = "junior"
        }
                 }

No we don’t need to restrict permissions based on configurations (but might consider it in the future).


#4

Can you try adding the ‘publishPermissions = ‘0777’’ line to that block?

I haven’t tested this, but it should work:

repositories {
                  add(new org.apache.ivy.plugins.resolver.SshResolver()) {
            name = 'test_repo'
            user = 'xxx'
            userPassword = 'xxx'
            addIvyPattern
    "/uwm/ivy-repo/[organisation]/[module]/ivys/ivy-[revision].xml"
            addArtifactPattern "/uwm/ivy-repo/[organisation]/[module]/[type]s/[artifact]-[revision](-[classifier]).[ext]"
            host = "junior"
            publishPermissions = '0777'
        }
                 }

(richard murray) #5

Thanks, that works. Is that in the documentation anywhere (the DSL referererence or API docs) as I couldn’t find anything like that?


(richard murray) #6

Hi, I can see that’s part of the Apache Ivy documentation here: http://ant.apache.org/ivy/history/latest-milestone/resolver/ssh.html

I didn’t think to look there.