[GRADLE-1200] Generated POM does not contain packaging, organization is simply org.apache.maven.model.Organization.toString() Created: 02/Nov/10  Updated: 26/Jan/17  Resolved: 26/Jan/17

Status: Resolved
Project: Gradle
Affects Version/s: 0.9
Fix Version/s: None

Type: Bug
Reporter: Joern Huxhorn Assignee: Unassigned
Resolution: Duplicate Votes: 5


 Description   

The following pom definition

    defaultProject= {
    	url 'http://gradle.huxhorn.de'
    	
    	inceptionYear '2010'
    	
    	packaging 'jar'
    	
    	scm {
    		connection 'scm:git:git://github.com/huxi/huxi-gradle-plugins.git'
    		developerConnection 'scm:git:ssh://git@github.com:huxi/huxi-gradle-plugins.git'
    		url 'http://github.com/huxi/huxi-gradle-plugins/'
    	}
    	
		licenses {
			license {
				name 'GNU Lesser General Public License v3 (LGPL)'
				url 'http://www.gnu.org/copyleft/lesser.html'
				distribution 'repo'
			}
			
			license {
				name 'The Apache Software License, Version 2.0'
				url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
				distribution 'repo'
			}
		}
		
		developers {
			developer {
				id 'huxhorn'
				email 'huxhorn@users.sourceforge.net'
				name 'Joern Huxhorn'
				organization 'Joern Huxhorn'
				organizationUrl 'http://lilith.huxhorn.de'
				roles {
					role 'Developer'
				}
			}
		}
		
		properties {
			'project.build.sourceEncoding' 'UTF-8'
			'project.reporting.outputEncoding' 'UTF-8'
		}
	}

generates this 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>de.huxhorn.gradle</groupId>
  <artifactId>de.huxhorn.gradle.pgp-plugin</artifactId>
  <version>0.0.2</version>
  <url>http://gradle.huxhorn.de</url>
  <inceptionYear>2010</inceptionYear>
  <licenses>
    <license>
      <name>GNU Lesser General Public License v3 (LGPL)</name>
      <url>http://www.gnu.org/copyleft/lesser.html</url>
      <distribution>repo</distribution>
    </license>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <developers>
    <developer>
      <id>huxhorn</id>
      <name>Joern Huxhorn</name>
      <email>huxhorn@users.sourceforge.net</email>
      <organization>org.apache.maven.model.Organization@371daf60</organization>
      <organizationUrl>http://lilith.huxhorn.de</organizationUrl>
      <roles>
        <role>Developer</role>
      </roles>
    </developer>
  </developers>
  <scm>
    <connection>scm:git:git://github.com/huxi/huxi-gradle-plugins.git</connection>
    <developerConnection>scm:git:ssh://git@github.com:huxi/huxi-gradle-plugins.git</developerConnection>
    <url>http://github.com/huxi/huxi-gradle-plugins/</url>
  </scm>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.8.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.6.1</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.bouncycastle</groupId>
      <artifactId>bcpg-jdk15</artifactId>
      <version>1.45</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>0.9.26</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <properties>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
</project>

The generated XML is missing <packaging>jar</packaging> and the <organization> contains org.apache.maven.model.Organization@371daf60 instead of Joern Huxhorn.

This might be better resembled by two separate issues but it would largely duplicate content so I just submitted a single one for now.



 Comments   
Comment by René Gröschke (Inactive) [ 09/Jan/11 ]

FYI: These two problems were discussed at the mailinglist with a workaround I think. have a look at http://www.mail-archive.com/user@gradle.codehaus.org/msg05368.html. We missed to create this issue here. thanks. René

Comment by Peter Niederwieser [ 27/Feb/11 ]

Here is a simple workaround to add a packaging type, tested with 1.0-milestone-1:

install {
  repositories.mavenInstaller {
    pom {
      withXml {
        def project = it.asNode()
        project.version[0] + { // add <packaging> after <version>
          packaging "pom"
        }
      }
    }
  }
}

For packaging type "jar" this isn't really necessary because "jar" is the default anyway, but for other packaging types (like "pom") it is critical.

Comment by Peter Niederwieser [ 28/Feb/11 ]

Here is why packaging = "pom" doesn't work:

1. If project has Java plugin applied, a Jar will be generated (even if the project has no sources), and Gradle will overwrite any packaging type set in the build script with "jar". Apparently Maven doesn't include packaging type "jar" in the generated XML because it is the default.

2. If project has Java plugin not applied, the Maven plugin won't add an install task.

Comment by Joern Huxhorn [ 01/Mar/11 ]

Ok, leaving out <packaging>jar</packaging> might be "works as expected"...
I didn't know that jar was the default packaging and can be omitted.
I'm also not 100% sure if this is entirely correct... I think http://nexus.sonatype.org/ complained about it but I'm not sure...

Concerning the other issue, the <organization>org.apache.maven.model.Organization@371daf60</organization> thing:

The workaround was to define it like this:
organization = 'Joern Huxhorn'
i.e. with an additional '='.

But it's IMHO just that: a workaround for the issue described in this ticket.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Joern Huxhorn [ 18/Nov/16 ]

Created https://github.com/gradle/gradle/issues/886

Generated at Wed Jun 30 11:49:32 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.