Type is actually determined only by the packaging of the referenced artifact’s pom. Therefore m2e behaves 100% correct. Whether a JAR (or more accurate, the manifest within) actually contains OSGi specific headers doesn’t matter here.
Just as a side note: Actually, even if the type is set to bundle this will not make Maven treat the dependency any different than a regular JAR (see also https://issues.apache.org/jira/browse/FELIX-4303). Other bundle artifacts do not even have a dedicated packaging, since e.g. the bnd-maven-plugin uses the maven-jar-plugin and also its packaging (https://github.com/bndtools/bnd/tree/master/maven/bnd-maven-plugin). Konrad > Am 25.05.2016 um 19:38 schrieb David M. Karr <[email protected]>: > > For a while I've been struggling with an issue where I see the search > facility in the "Add" dialog offering some artifacts that are "jar" > artifacts, and some that are "bundle" artifacts. I know the basic difference > between them. The funny thing is, I believe that these artifacts are all > structured similarly, so I'm not sure why it thinks some are "bundle" > artifacts and some are "jar". > > I think I found a clue that might explain that last point. I looked at the > two pom artifacts (one m2e says is a "bundle", the other a "jar"), and the > only significant difference is that the "bundle" artifact has a "packaging" > property set to "bundle". the other doesn't have a packaging property. > Ironically, the "jar" artifact's pom uses the "maven-bundle-plugin" (with > extensions = true), but I guess that isn't enough for m2e to recognize it as > a bundle. > > The bigger problem is that m2e is offering these "bundle" artifacts into a > pom that doesn't necessarily know what a bundle is. After I store the > dependency reference to the bundle artifact, the project fails to build. If > I manually edit the properties of the dependency, changing it to a "jar", it > works fine. > > I know understand that I have to add the "maven-bundle-plugin" reference to > the pom for this to work, but the underlying question is, why does m2e offer > bundle artifacts into a pom that doesn't know what bundle artifacts are? > > I imagine the obvious answer is "because it doesn't know not to", or some > variation of that. > > Before I file a bug report, would it be a reasonable enhancement to expect > the m2e search facility in the "Add" dialog to introspect the pom and > determine whether bundles can be used in the pom in question, and if not, > offer bundle artifacts as jar artifacts instead? > _______________________________________________ > m2e-users mailing list > [email protected] > To change your delivery options, retrieve your password, or unsubscribe from > this list, visit > https://dev.eclipse.org/mailman/listinfo/m2e-users _______________________________________________ m2e-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/m2e-users
