Visit my.sonatype.com for documentation on Nexus Repository version 2.
Easy. Here's an example of a build.gradle file that configures a build to publish artifacts to a snapshot repository. As you can see, the publish URL, credentials, and artifact identifiers for this project are all contained in the uploadArchives configuration section.
apply plugin: 'java' apply plugin: 'maven' repositories { maven { url "http://localhost:8081/nexus/content/groups/public" } } dependencies { testCompile "junit:junit:3.8.1" compile "org.jbundle.util:org.jbundle.util.jbackup:2.0.0" compile "net.sf.webtestfixtures:webtestfixtures:2.0.1.3" } uploadArchives { repositories { mavenDeployer { repository(url: "http://localhost:8081/nexus/content/repositories/snapshots") { authentication(userName: "admin", password: "admin123") } pom.version = "1.0-SNAPSHOT" pom.artifactId = "simple-project" pom.groupId = "com.example" } } }
To upload artifacts from this project, run "gradle upload"
5 Comments
What might cause gradle to upload to mirror url instead of snapshots url? In settings mirror and snapshots are defined. When I download I use the groups/public url. When I upload I specify repo url and id for snapshots but see a 400 error after gradle attempts to upload to the groups url.
Any suggestions?
Thanks
Peter
Do you have any sample scripts that will allow the deploy of multiple artifacts? Say I have 16 artifacts I need. Do you have a script that will crawl through a directory and deploy any poms that it identifies? I know this can be done through Rsync...but have a desire to take a different approach to it. Any information you could provide would be appreciated.
Thanks
Landon
What protocol does uploadArchive task in gradle use ? I know a build tool such as gradle use GET, to resolve dependencies form Nexus or any repository during compileJava or test tasks. I wanted to know what protocol does gradle use when publishing/distributing the built war file to repository ? Because, my gradle tasks are working find until :war. But, when it gets to uploadArchive, build fails with "Connection time out error".
Note: By build tool is behind proxy. But can successfully resolve dependencies using GET http.
When there is a good connection between my Nexus repository and gradle during compile/test tasks via proxy, why not during uploadArchive ?
Any help ? Highly appreciated.
Gradle uses HTTP PUT requests to upload archives.
We are closing this article for comments.
If you have a support license, please contact us by submitting a support ticket.
If you do not have a support license, please use our Nexus Users List or our other free support resources.