On Tue, Mar 9, 2010 at 3:31 PM, Jesse Eichar <[email protected]>wrote:

>
> On Mar 9, 2010, at 7:43 AM, Hans Dockter wrote:
>
>
>
> On Mon, Mar 8, 2010 at 9:14 PM, Jesse Eichar 
> <[email protected]>wrote:
>
>>
>> On Mon, Mar 8, 2010 at 5:36 PM, Jesse Eichar <[email protected]
>> > wrote:
>>
>>> Hi,
>>>
>>> I have customized my build so that there are 3 artifacts.  I have
>>> customized uploadArtifacts so all 3 artifacts are uploaded to a remote maven
>>> repository.  Now I want to customize install so that they are installed in
>>> the local repository.
>>>
>>
>> After applying the Maven plugin there is an install task. Executing this
>> install task will store by default all artifacts of the archives
>> configuration to your local Maven repo. By default the default jar is part
>> of the archives configuration. You can add additional jars like:
>>
>> artifacts {
>>    archives jar1, jar2
>> }
>>
>>
>> This is what I tried at first because that is how I expected it to work.
>>  I am using 0.8 so perhaps there is a bug related to what I am doing.    I
>> am glad to know that is how it is expected to work.  I am sure I can figure
>> it out now that I know that is the correct method.
>>
>
> Do those jars belong to the same pom (i.e. just differ in their
> classifier)?
>
> You said that the remote upload works. In that case the install should work
> as well.
>
> What exception do you get with the above approach?
>
> - Hans
>
>
> The artifacts require different poms and have different ids:  print-lib,
> print-servlet, print-standalone.  I was migrating the project from a
> multiproject maven build system where there were 4 projects 3 of which only
> had poms and not code or resources.  So I merged them into one gradle
> project.
>
> The uploadArtifacts works great because I use filters:
>
>     addFilter('lib') { artifact, file ->
>       artifact.name.contains 'print-lib'
>     }
>     addFilter('standalone') { artifact, file ->
>       artifact.name.contains 'print-standalone'
>     }
>     addFilter('war') { artifact, file ->
>       artifact.name.contains 'print-servlet'
>     }
>

You need to apply the same filters to the install task. Something like this
should work (in the future we will provide more convenient ways of doing
this):

installer = install.repositories.mavenInstaller

def deployer = null
uploadArchives {
    repositories
       deployer = mavenDeployer {
            repository(url: "file://localhost/tmp/myRepo/")
       }
    }
}

[installer, deployer].each { repo ->
   configure(repo) {
       addFilter('lib') ....
    }
}

- Hans

--
Hans Dockter
Founder, Gradle
http://www.gradle.org, http://twitter.com/gradleorg
CEO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to