Search code examples
mavennexuspom.xmlmaven-central

Why is the <packaging> element included


When I navigate to - http://search.maven.org/#artifactdetails%7Corg.apache.portals.pluto%7Cpluto-container-api%7C2.0.2%7Cbundle

the dependency is -

<dependency>
    <groupId>org.apache.portals.pluto</groupId>
    <artifactId>pluto-container-api</artifactId>
    <version>2.0.2</version>
    <packaging>bundle</packaging>
</dependency>

Should it not be -

<dependency>
    <groupId>org.apache.portals.pluto</groupId>
    <artifactId>pluto-container-api</artifactId>
    <version>2.0.2</version>
</dependency>

As including the tag seems to cause an error, attached -

enter image description here


Solution

  • It seems like a fair assumption that the XML you quote is intended to be copied and pasted into a pom.xml.

    You're right. Removing <packaging> is the correct thing to do.

    There's no need to specify the type, because the bundles artifacts have a 'jar' extension anyway. Even if the packaging was not 'jar' ‒say, for example, it was 'war'‒ the correct element to use would be <type> and not <packaging>.