Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Custom Maven Plugin and M2E.

META-INF/m2e/lifecycle-mapping-metadata.xml is what tells m2e to execute
the plugin during workspace build. Without this file all users of your
plugin will have to configure it explicitly in pom.xml, something you
most likely want to avoid.

Also note, your plugin unconditionally creates output file each time it
is executed. This WILL result in endless workspace build if you tell m2e
to execute the plugin during incremental workspace build. If you really
need to capture current timestamp in a file, I suggest you configure
plugin execution during full workspace build only.

--
Regards,
Igor

On 2015-01-25 18:20, Alexandre Araujo Moreira wrote:
Thanks for the reply Igor. I had purposely left that part out of that
code because It didn't seem to work for me the first time I tried, so I
assumed the tutorial was outdated. It turns out I was mixing the javadoc
style "annotations" used in that tutorial and the current real
annotations used to describe the @Component on the BuildContext. That
solved one of my first problems: BuildContext instance was, obviously,
coming out null.

I had a second problem, which was the constant build errors appearing on
my eclipse project, which prevented me from hitting the point where m2e
would try to run my plugin. Turns out another piece of documentation[1]
helped me in that regard and I managed to make it run (without the Build
Context, will update to use it properly soon). I'll have to make some
more tests, but considering the amount of repeated information on both
the plugin and the use site, I believe the xml file in the META-INF will
end up being unnecessary, but this will need confirmation. So far, I got
it to work with the current version on github.

Thanks again for your help.

[1]:
https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html

On Sun, Jan 25, 2015 at 8:29 PM, Igor Fedorenko <igor@xxxxxxxxxxxxxx
<mailto:igor@xxxxxxxxxxxxxx>> wrote:

    It is certainly possible to run custom maven plugins during eclipse
    workspace.

    According to the wiki page you reference, m2e-compatible plugins must
    use BuildContext API and must include
    META-INF/m2e/lifecycle-__mapping-metadata.xml. Your plugin does not
    appear
    to do either.

    --
    Regards,
    Igor


    On 2015-01-25 16:37, Alexandre Araujo Moreira wrote:

        Hello, everybody.

        I've been trying my hand at writing simple plugins for Maven and
        so far
        haven't had any problem running them on the mvn command line. When
        trying to use these same plugins on eclipse (Luna, under m2e)
        I've been
        completely lost. I tried following instructions on[1] to no avail.

        In the end I decided to try asking for help here -- and I hope
        it's the
        right place. First, I need to know if it is at all possible to
        have a
        custom plugin be ran by m2e when the eclipse auto-build feature
        kicks
        in, or while publishing a project to a development server (under
        Eclipse's "Servers" view). If any of these are possible, I'd really
        appreciate some help in figuring out how to make it happen.

        I've set up two minimal projects which are, respectively, a simple
        timestamp-file generating maven plugin[2] and a dummy project which
        declares this plugin on its pom[3] on github, which we can use as a
        common ground on discussing this if discussion is warranted. I
        use those
        on the command line and everything's fine.

        Thanks,
        Alexandre Moreira


        [1]: https://wiki.eclipse.org/M2E___compatible_maven_plugins
        <https://wiki.eclipse.org/M2E_compatible_maven_plugins>
        [2]: https://github.com/__alexandream/timestamp-maven-__plugin
        <https://github.com/alexandream/timestamp-maven-plugin>
        [3]:
        https://github.com/__alexandream/timestamp-maven-__plugin-sandbox <https://github.com/alexandream/timestamp-maven-plugin-sandbox>


        _________________________________________________
        m2e-users mailing list
        m2e-users@xxxxxxxxxxx <mailto:m2e-users@xxxxxxxxxxx>
        To change your delivery options, retrieve your password, or
        unsubscribe from this list, visit
        https://dev.eclipse.org/__mailman/listinfo/m2e-users
        <https://dev.eclipse.org/mailman/listinfo/m2e-users>

    _________________________________________________
    m2e-users mailing list
    m2e-users@xxxxxxxxxxx <mailto:m2e-users@xxxxxxxxxxx>
    To change your delivery options, retrieve your password, or
    unsubscribe from this list, visit
    https://dev.eclipse.org/__mailman/listinfo/m2e-users
    <https://dev.eclipse.org/mailman/listinfo/m2e-users>




--
"Bad programming is easy. Idiots can learn it in 21 days, even if they
are dummies."
- As seen in 'How to Design Programs'



_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/m2e-users



Back to the top