I suppose I wasn't clear.

If the packaging type of the artifact is "bundle", it's reasonable for m2e to offer it as a bundle artifact, but I think it's also reasonable for it to notice that the POM this dependency will be inserted into does not recognize bundle artifacts, and make the user aware of that somehow, and perhaps offer an "automatic downgrade" of the artifact to "jar" type.

On 05/26/2016 06:49 AM, Matthew Piggott wrote:
Without looking at the code but I'd hazard that m2e has to guess the extension and as the packaging type is usually the extension (according to maven docs) m2e chooses it.

On 25 May 2016 at 17:37, David M. Karr <davidmichaelk...@gmail.com <mailto:davidmichaelk...@gmail.com>> wrote:

    On 05/25/2016 10:54 AM, Konrad Windszus wrote:

        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


    I'm not sure what you mean by "will not make Maven ...".  If I
    specify it as a bundle, and without the "maven-bundle-plugin", the
    build fails to find the artifact.

    Concerning "m2e behaves 100% correct", I'd say that's a matter of
    interpretation.  If you limit the scope of "correct behavior" to
    just looking at the artifact in question, you're right.  If you
    consider whether m2e is doing a good job of protecting the user
    from creating a situation that will definitely fail, perhaps not
    so much.


            Am 25.05.2016 um 19:38 schrieb David M. Karr
            <davidmichaelk...@gmail.com
            <mailto:davidmichaelk...@gmail.com>>:

            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
            m2e-users@eclipse.org <mailto:m2e-users@eclipse.org>
            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
        m2e-users@eclipse.org <mailto:m2e-users@eclipse.org>
        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
    m2e-users@eclipse.org <mailto:m2e-users@eclipse.org>
    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
m2e-users@eclipse.org
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
m2e-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/m2e-users

Reply via email to