Thanks again. I gave that a go but I got an error:

-----------------------
> gradle install

:local-gov-bof:compileJava UP-TO-DATE
:local-gov-bof:processResources UP-TO-DATE
:local-gov-bof:classes UP-TO-DATE
:local-gov-bof:gov.local.bof.echo.api UP-TO-DATE
:local-gov-bof:gov.local.bof.echo.impl UP-TO-DATE
:local-gov-bof:jar UP-TO-DATE
:local-gov-bof:install

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':local-gov-bof:install'.
Cause: Could not publish configurations [configuration
':local-gov-bof:archives'
].
Cause: A POM cannot have multiple artifacts with the same type and
classifier. A
lready have MavenArtifact local-gov-bof:jar:jar:null, trying to add
MavenArtifac
t local-gov-bof:jar:jar:null.
-----------------------

The relevant of my build script looks like this:

def components = [
[name: "${group}.echo.api", pattern: "${patternPrefix}/echo/api/**"],
 [name: "${group}.echo.impl", pattern: "${patternPrefix}/echo/impl/**"],
]

components.each { component ->
 project.task(component.name, type: Jar) {
baseName = component.name
 from sourceSets.main.classes
include component.pattern
}
}

artifacts {
    components.each { archives(tasks[it.name]) }
}

uploadArchives {
repositories.mavenDeployer {
 repository(url: projectReleases) {
   authentication(userName: mavenRepoUsername,
         password: mavenRepoPassword)
}
snapshotRepository(url: projectSnapshots) {
   authentication(userName: mavenRepoUsername,
password: mavenRepoPassword)
 }
components.each { component ->
addFilter(component.name) { artifact, file ->
 artifact.name == component.name
}
 }
}
}

install {
repositories.mavenDeployer {
 repository(url: "file://" + System.getProperty('user.home') +
"/.m2/repository/")
components.each { component ->
 addFilter(component.name) { artifact, file ->
artifact.name == component.name
 }
}
}
}

Regards

Mark


On 21 June 2011 10:53, Luke Daley <[email protected]> wrote:

>
> On 21/06/2011, at 6:34 PM, Mark Davidson wrote:
>
> > That works really well. Thanks for this - much appreciated! To have a
> single project generating multiple jars compared to 20+ related projects
> could be a real timesaver for me.
> >
> > Would I have to do something some extra configuration to get 'gradle
> install' to work as well?
>
>
> Sure is…
>
> install {
>    repositories.mavenInstaller {
>         repository(url: "file://localhost/tmp/myRepo/")
>        components.each { component ->
>            addFilter(component.name) { artifact, file -> artifact.name ==
> component.name }
>        }
>    }
> }
>
> --
> Luke Daley
> Principal Engineer, Gradleware
> http://gradleware.com
>
> Please vote Gradle for JAX Awards » http://vote.jax-awards.com
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

Reply via email to