[maven plugin] Unable to set developer organization in generated POM file using the pom.project {} closure

The following will not work as expected:

pom.project {
  developers {
    developer {
      name 'Louis Jacomet'
      organization 'MyOrganization'
    }
  }
}

The resulting tag in the produced pom will be something like:

<organization>org.apache.maven.model.Organization@7beef0a8</organization>

I am assuming this comes from the fact that the pom file contains an organization tag at the first level which happens to be a complex type while the one inside developer is a simple node with text.

Environment:

$ ./gradlew --version

------------------------------------------------------------
Gradle 2.6
------------------------------------------------------------

Build time:   2015-08-10 13:15:06 UTC
Build number: none
Revision:     233bbf8e47c82f72cb898b3e0a96b85d0aad166e

Groovy:       2.3.10
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.6.0_65 (Apple Inc. 20.65-b04-466.1)
OS:           Mac OS X 10.10.5 x86_64

Find below a patch for DefaultMavenPomTest that shows the problem:

diff --git a/subprojects/maven/src/test/groovy/org/gradle/api/publication/maven/internal/pom/DefaultMavenPomTest.groovy b/subprojects/maven/src/test/groovy/org/gradle/api/publication/maven/internal/pom/DefaultMavenPomTest.groovy
index 7d9d33e..fa21c6e 100644
--- a/subprojects/maven/src/test/groovy/org/gradle/api/publication/maven/internal/pom/DefaultMavenPomTest.groovy
+++ b/subprojects/maven/src/test/groovy/org/gradle/api/publication/maven/internal/pom/DefaultMavenPomTest.groovy
@@ -136,6 +136,12 @@ class DefaultMavenPomTest extends Specification {
                     distribution 'repo'
                 }
             }
+            developers {
+                developer {
+                    name 'Louis Jacomet'
+                    organization 'MyOrganization'
+                }
+            }
         }
 
         expect:
@@ -147,6 +153,7 @@ class DefaultMavenPomTest extends Specification {
         mavenPom.mavenProject.licenses[0].name == 'The Apache Software License, Version 2.0'
         mavenPom.mavenProject.licenses[0].url == 'http://www.apache.org/licenses/LICENSE-2.0.txt'
         mavenPom.mavenProject.licenses[0].distribution == 'repo'
+        mavenPom.mavenProject.developers[0].organization == 'MyOrganization'
     }
 
     void writeToShouldApplyXmlActions() {

I think it works if you use =

pom.project {
  developers {
    developer {
      name = 'Louis Jacomet'
      organization = 'MyOrganization'
    }
  }
}

So doing organization = 'MyOrganization' indeed resolves the problem.

Thanks!