Maven plugin project missing groupId in generated pom.xml


(Jeremy Whiting) #1

Hi,

I am attempting to generate a pom.xml but it is missing a tag. The maven plugin I’ve written has a dependency on the maven-plugin-plugin.

This is my reproducer project.

$ cat build.gradle
 apply plugin: 'maven'
  defaultTasks 'assemble'
  task writeNewPom << {
    file("$buildDir/src/main/resources").mkdirs()
    pom {
        project {
            groupId
'org.jboss.perf.test'
            packaging 'acme-plugin'
            version '1.0'
            name 'Acme Plugin to build a trap to catch a Road Runner.'
            build {
                plugins {
                    plugin {
                        groupId 'org.apache.maven.plugins'
                       artifactId 'maven-plugin-plugin'
                       version '3.1'
                       configuration {
                          skipErrorNoDescriptorsFound 'true'
                       }
                    }
                }
            }
            properties {
               'project.build.sourceEncoding' 'UTF-8'
            }
        }
    }.writeTo("$buildDir/src/main/resources/pom.xml")
}
assemble.dependsOn writeNewPom
$ gradle clean assemble
:clean
:writeNewPom
:assemble
  BUILD SUCCESSFUL
  Total time: 1.002 secs
$ cat build/src/main/resources/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.jboss.perf.test</groupId>
  <artifactId>acme-maven-plugin</artifactId>
  <version>1.0</version>
  <packaging>acme-plugin</packaging>
  <name>Acme Plugin to build a trap to catch a Road Runner.</name>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
</project>
$

As you can see, the generated pom.xml is missing this line

<groupId>org.apache.maven.plugins</groupId>

Did I make a mistake when configuring the MavenPom ?

Regards, Jeremy

I am using Gradle 1.9, OpenJDK 1.7.0_45, Fedora19.


(Jeremy Whiting) #2

hmm, this behaviour seems to be by design in the MODELLO project.

http://jira.codehaus.org/browse/MNG-4131

Till the feature request in the MODELLO project is complete this isn’t going to work. I’ll add a JIRA to track this and have the version bumped up.