I'm not sure what you mean by externalize configuration for multiple
projects, but we use Nexus quite happily with Gradle at work.  It's a great
product ;).

Here's how I set it up in our project's root build.gradle file:

-----------------
artifactRepositoryRoot = "http://ourNexusHost:somePort
/nexus/content/repositories"
releasesRepositoryRoot = "$artifactRepositoryRoot/releases" //company
relases for any project
snapshotsRepositoryRoot = "$artifactRepositoryRoot/snapshots" //company
snapshots for any project

/* The following values are acquired from $HOME/.gradle/gradle.properties
during build time.  They allow uploading
   of a build's generated artifacts directly to the company's repository
server.  In practice, this is almost always
   done by a build server upon a successful build, and should rarely be
needed by developers.

   But, if you feel you need to still upload libs to the company's central
repository, you need a user account on the
   above repository server with the proper permissions.  After ensuring you
have that, then create a

   $HOME/.gradle/gradle.properties

   file with the following properties:

   nexus.repo.releases.username = blah
   nexus.repo.releases.password = blah
   ... etc.
*/
releasesRepositoryUsername = project["nexus.repo.releases.username"]
releasesRepositoryPassword = project["nexus.repo.releases.password"]
snapshotsRepositoryUsername = project["nexus.repo.snapshots.username"]
snapshotsRepositoryPassword = project["nexus.repo.snapshots.password"]

...

usePlugin("java")

...

dependencies {
  addMavenStyleRepo("snapshots", snapshotsRepositoryRoot) //company
snapshots for any project
  addMavenStyleRepo("thirdparty", artifactRepositoryRoot + "/thirdparty") //
3rd party libs not in maven central
  addMavenStyleRepo("releases", releasesRepositoryRoot) //company releases
for any project
  addMavenStyleRepo("public", artifactRepositoryRoot + "/central"); //nexus
proxy to maven central repo

  ...
  //needed to upload snapshots to nexus:
  addConfiguration("deployerJars")
  deployerJars "org.apache.maven.wagon:wagon-http:1.0-bet...@jar",
"org.apache.maven.wagon:wagon-http-shared:1.0-bet...@jar"
}

...

uploadLibs {
  uploadResolvers.addMavenDeployer('maven-deployer') {
    uniqueVersion = false
    addProtocolProviderJars(dependencies.resolve('deployerJars'))
    repository(url: releasesRepositoryRoot) {
      authentication(userName: releasesRepositoryUsername, password:
releasesRepositoryPassword)
      releases()
      snapshots()
      proxy()
    }
    snapshotRepository(url: snapshotsRepositoryRoot) {
      authentication(userName: snapshotsRepositoryUsername, password:
snapshotsRepositoryPassword)
      releases()
      snapshots()
      proxy()
    }
  }
}

...

HTH,

Les

On Fri, Jan 23, 2009 at 6:50 AM, Gregory Boissinot <
[email protected]> wrote:

>
> Hi,
>
> Is it the best way to binding Gradle with a Maven repository manager like
> Archiva or Nexus
>
> Provide the following code in a Gradle project:
> dependencies{
>
> addMavenStyleRepo('archivaRepo','
> http://p121142:8090/archiva/repository/releases-group/')
>
> }
>
> Is it possible to externalize this configuration for multiple projects?
> --
> View this message in context:
> http://www.nabble.com/Gradle-with-a-Maven-repository-manager-tp21623124p21623124.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

Reply via email to