On 10/02/2011, at 7:54 AM, Steve Ebersole wrote:

> This is what I have so far:
> 
> configurations {
>    testing
> }
> 
> task testingJar(type: Jar, dependsOn: compileTestJava) {
>    from sourceSets.test.classes
>    includes += "org/hibernate/testing/**"
>    baseName = 'hibernate-testing'
> }
> 
> task testingSourcesJar(type: Jar, dependsOn: compileTestJava) {
>    from sourceSets.test.allSource
>    includes += "org/hibernate/testing/**"
>    baseName = 'hibernate-testing'
>    classifier = 'sources'
> }
> 
> artifacts {
>    testing testingJar, testingSourcesJar
> }
> 
> // ugh, lots of duplication with uploadArchives
> uploadTesting {
>    repositories.mavenDeployer {
>        name = 'jbossDeployer'
>        configuration = configurations.deployerJars
>        pom.project basePomConfig
>        pom.artifactId = 'hibernate-testing'
>        repository(id: "jboss-releases-repository", url: 
> "https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/";)
>        snapshotRepository(id: "jboss-snapshots-repository", url: 
> "https://repository.jboss.org/nexus/content/repositories/snapshots";)
>    }
> }
> 
> uploadArchives.dependsOn uploadTesting
> 
> task installTesting(type:Upload, dependsOn: [testingJar,testingSourcesJar]) {
>    configration = configurations.testing

This should be 'configuration', not 'configration'

What the above does is adds a dynamic property called 'configration' to the 
task. I'd really like to get rid of this implicit creation of dynamic 
properties, as they just cause too much confusion when you have a typo.

>    artifacts = configurations.testing

You won't need to set this if configuration is set.

>    repositories.mavenInstaller {
>        name = RepositoryHandler.DEFAULT_MAVEN_INSTALLER_NAME
>        pom.project basePomConfig
>        pom.artifactId = 'hibernate-testing'
>    }
> }
> 
> install.dependsOn installTesting
> uploadTesting.dependsOn installTesting
> 
> Aside from the boatloads of duplication this *almost* works.  
> "uploadArchives" 
> and "uploadTesting" work as expected.  "install" works as well.  However, 
> Gradle complains about the definition of "installTesting" (which I took 
> directly from MavenPlugin code).  The error says that "No value has been 
> specified for property 'artifacts'" on task "installTesting".

This is a misleading error message - the problem is that no value has been 
specified for property 'configuration'.


>  Yet if I try to 
> specify one (as above), it complains.  My understanding was that 'artifacts' 
> was determined based on 'configration'?
> 
> 
> On Wednesday, February 09, 2011, at 10:23 am, Steve Ebersole wrote:
>> I've seen a few posts about a single project producing multiple artifacts
>> and even regarding uloading those artifacts to a repository.  And I have
>> read
>> http://gradle.org/0.9.2/docs/userguide/userguide_single.html#sub:multiple_
>> artifacts_per_project and related sections.
>> 
>> But I have not found information about handling these multiple artifacts:
>> a) with customized poms
>> b) through the install task of the Maven plugin
>> 
>> Essentially I have 6 artifacts produced by this one project, the two "main"
>> artifacts plus source and javadocs jars for each:
>> 
>> task testingJar(type: Jar, dependsOn: compileTestJava) {
>>    from sourceSets.test.classes
>>    includes += "org/hibernate/testing/*"
>>    baseName = 'hibernate-testing'
>> }
>> 
>> As I mentioned I use a customized pom already (from the root project):
>> def pomConfig = {
>>    url 'http://hibernate.org'
>>    ...
>> }
>> 
>> configure(install.repositories.mavenInstaller) {
>>    pom.project pomConfig
>> }
>> 
>> uploadArchives {
>>    repositories.mavenDeployer {
>>        name = 'jbossDeployer'
>>        configuration = configurations.deployerJars
>>        pom.project pomConfig
>>        repository(url: ...)
>>        snapshotRepository(url: ...)
>>    }
>> }
>> 
>> From this point I am really just lost.  The new artifact needs an
>> overridden artifactId in the pom (it cannot use the project name).  In
>> terms of uploading and installing, I have seen both the filter approach
>> and split configuration naming.  But it seems like each require an awful
>> lot of duplication in setting up.
>> 
>> Can anyone help show me the light?
>> 
>> 
>> P.S. Personally, it seems to me that these details should be handled much
>> more transparently by the maven plugin.  For example, in my opinion if an
>> artifact is uploaded to a repository by the maven deployer it ought to
>> automatcally be handled by the install task :
>> http://jira.codehaus.org/browse/GRADLE-1383
>> 
>> 
>> ---
>> Steve Ebersole <[email protected]>
>> http://hibernate.org
> 
> ---
> Steve Ebersole <[email protected]>
> http://hibernate.org
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>    http://xircles.codehaus.org/manage_email
> 
> 


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to