Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Sample Lifecycle Metadata Entry?

Definitely good advice.  I will suggest it to our lead but for the most part, we don't check in IDE specific settings since we don't have uniformity among the IDEs used (some use Eclipse, some IntelliJ, some VI and Emacs).  Thus, I am not sure what his stance will be.

Thanks.

Keith

On Thu, Aug 30, 2012 at 11:28 AM, Igor Fedorenko <igor@xxxxxxxxxxxxxx> wrote:
Workspace preferences only affect your local configuration and won't
help other members of your team, unless, of course, they all do the same
configuration. I strongly recommend providing the mapping either in the
maven plugin itself or in the parent pom and only use workspace
preferences for projects you don't control.

--
Regards,
Igor


On 12-08-30 10:35 AM, Keith Barlow wrote:
Igor,

No, I am referring to the lifecycle-mapping-metadata.xml file referenced
in the Eclipse Preferences->Maven->Lifecycle Mappings which I currently
have created a file in the default location of
"~/workspace/.metadata/.plugins/org.eclipse.m2e.core/lifecycle-mapping/metadata.xml"
  (NOTE: I have the full path even though I only wrote out the relative
one here.)

I hadn't tried updating project info before but did not and am
definitively getting a null pointer both with and without specifing
groupId and artifactId.  Here are the NPEs:

Without groupId and artifactId:

4452 !ENTRY org.eclipse.core.jobs <http://org.eclipse.core.jobs> 4 2

2012-08-30 10:25:28.180
4453 !MESSAGE An internal error occurred during: "Updating Maven Project".
4454 !STACK 0
4455 java.lang.NullPointerException
4456     at
org.eclipse.m2e.core.internal.lifecyclemapping.model.PluginExecutionFilter.match(PluginExecutionFilter.java:323)
4457     at
org.eclipse.m2e.core.internal.lifecyclemapping.SimpleMappingMetadataSource.getPluginExecutionMetadata(SimpleMappingMetadataSource.java:71)
4458     at
org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateEffectiveLifecycleMappingMetadata(LifecycleMappingFactory.java:
     490)
4459     at
org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateEffectiveLifecycleMappingMetadata(LifecycleMappingFactory.java:
     224)
4460     at
org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateLifecycleMapping(LifecycleMappingFactory.java:175)
4461     at
org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.setupLifecycleMapping(ProjectRegistryManager.java:527)
4462     at
org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:446)
4463     at
org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:328)
4464     at
org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:279)
4465     at
org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:323)
4466     at
org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:74)
4467     at
org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
4468     at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

*With groupId and artifactId:*

4473 !ENTRY org.eclipse.core.jobs <http://org.eclipse.core.jobs> 4 2

2012-08-30 10:28:28.662
4474 !MESSAGE An internal error occurred during: "Updating Maven Project".
4475 !STACK 0
4476 java.lang.NullPointerException
4477     at
org.eclipse.m2e.core.internal.lifecyclemapping.model.PluginExecutionFilter.match(PluginExecutionFilter.java:337)
4478     at
org.eclipse.m2e.core.internal.lifecyclemapping.SimpleMappingMetadataSource.getPluginExecutionMetadata(SimpleMappingMetadataSource.java:71)
4479     at
org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateEffectiveLifecycleMappingMetadata(LifecycleMappingFactory.java:
     490)
4480     at
org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateEffectiveLifecycleMappingMetadata(LifecycleMappingFactory.java:
     224)
4481     at
org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory.calculateLifecycleMapping(LifecycleMappingFactory.java:175)
4482     at
org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.setupLifecycleMapping(ProjectRegistryManager.java:527)
4483     at
org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:446)
4484     at
org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:328)
4485     at
org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:279)
4486     at
org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:323)
4487     at
org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:74)
4488     at
org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
4489     at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Thanks.

Keith

On Wed, Aug 29, 2012 at 10:22 PM, Igor Fedorenko <igor@xxxxxxxxxxxxxx
<mailto:igor@xxxxxxxxxxxxxx>> wrote:

    You are talking about META-INF/m2e/lifecycle-__mapping-metadata.xml

    inside
    your maven plugin jar, right? For the record, m2e is able to use mapping
    metadata from test maven plugin [1].

    Do you Update Project Configuration after changing mapping metadata?
    There may be a problem with -SNAPSHOT plugins, so you may need to
    restart Eclipse for m2e to pick up new metadata.


    [1]
    https://github.com/sonatype/__m2e-core-tests/blob/master/__org.eclipse.m2e.tests/__repositories/testrepo-src/__test-embeddedmapping-plugin/__src/main/resources/META-INF/__m2e/lifecycle-mapping-__metadata.xml

    <https://github.com/sonatype/m2e-core-tests/blob/master/org.eclipse.m2e.tests/repositories/testrepo-src/test-embeddedmapping-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml>

    --
    Regards,
    Igor


    On 12-08-29 6:07 PM, Keith Barlow wrote:

        Igor,

        Attempting to follow your advice, I added the following to my
        lifecycle-mapping-metadata.__xml:


        <lifecycleMappingMetadata>
            <pluginExecutions>
              <pluginExecution>
                <pluginExecutionFilter>
                  <goals>
                    <goal>generate</goal>
                  </goals>
                </pluginExecutionFilter>
                <action>
                  <execute>
                    <runOnIncremental>false</__runOnIncremental>
                    <runOnConfiguration>true</__runOnConfiguration>

                  </execute>
                </action>
              </pluginExecution>
            </pluginExecutions>
        </lifecycleMappingMetadata>

        which seemed to result in a null pointer exception.

          From the .log file:

        3450 !ENTRY org.eclipse.core.resources 4 75 2012-08-29 17:52:37.351
        3451 !MESSAGE Errors occurred during the build.
        3452 !SUBENTRY 1 org.eclipse.m2e.core 4 75 2012-08-29 17:52:37.351
        3453 !MESSAGE Errors running builder 'Maven Project Builder' on
        project
        'project1'.
        3454 !STACK 0
        3455 java.lang.NullPointerException
        3456     at
        org.eclipse.m2e.core.internal.__lifecyclemapping.model.__PluginExecutionFilter.match(__PluginExecutionFilter.java:__323)
        3457     at
        org.eclipse.m2e.core.internal.__lifecyclemapping.__SimpleMappingMetadata
        Source.__getPluginExecutionMetadata(__SimpleMappingMetadataSource.__java:71)
        3458     at
        org.eclipse.m2e.core.internal.__lifecyclemapping.__LifecycleMappingFactory.__calculateEffectiveLifecycleMap__pingMetadata(__LifecycleMappingFactory.java:
              490)
        3459     at
        org.eclipse.m2e.core.internal.__lifecyclemapping.__LifecycleMappingFactory.__calculateEffectiveLifecycleMap__pingMetadata(__LifecycleMappingFactory.java:
              224)
        3460     at
        org.eclipse.m2e.core.internal.__lifecyclemapping.__LifecycleMappingFactory.__calculateLifecycleMapping(__LifecycleMappingFactory.java:__175)
        3461     at
        org.eclipse.m2e.core.internal.__project.registry.__ProjectRegistryManager.__setupLifecycleMapping(__ProjectRegistryManager.java:__527)
        3462     at
        org.eclipse.m2e.core.internal.__project.registry.__ProjectRegistryManager.__refresh(__ProjectRegistryManager.java:__446)
        3463     at
        org.eclipse.m2e.core.internal.__project.registry.__ProjectRegistryManager.__refresh(__ProjectRegistryManager.java:__328)
        3464     at
        org.eclipse.m2e.core.internal.__project.registry.__ProjectRegistryManager.__refresh(__ProjectRegistryManager.java:__279)
        3465     at
        org.eclipse.m2e.core.internal.__project.registry.__MavenProjectManager.refresh(__MavenProjectManager.java:58)
        3466     at
        org.eclipse.m2e.core.internal.__builder.MavenBuilder.build(__MavenBuilder.java:87)
        3467     at
        org.eclipse.core.internal.__events.BuildManager$2.run(__BuildManager.java:728)
        3468     at
        org.eclipse.core.runtime.__SafeRunner.run(SafeRunner.__java:42)
        3469     at
        org.eclipse.core.internal.__events.BuildManager.__basicBuild(BuildManager.java:__199)
        3470     at
        org.eclipse.core.internal.__events.BuildManager.__basicBuild(BuildManager.java:__239)
        3471     at
        org.eclipse.core.internal.__events.BuildManager$1.run(__BuildManager.java:292)
        3472     at
        org.eclipse.core.runtime.__SafeRunner.run(SafeRunner.__java:42)
        3473     at
        org.eclipse.core.internal.__events.BuildManager.__basicBuild(BuildManager.java:__295)
        3474     at
        org.eclipse.core.internal.__events.BuildManager.__basicBuildLoop(BuildManager.__java:351)
        3475     at
        org.eclipse.core.internal.__events.BuildManager.build(__BuildManager.java:374)
        3476     at
        org.eclipse.core.internal.__events.AutoBuildJob.doBuild(__AutoBuildJob.java:143)
        3477     at
        org.eclipse.core.internal.__events.AutoBuildJob.run(__AutoBuildJob.java:241)
        3478     at
        org.eclipse.core.internal.__jobs.Worker.run(Worker.java:__54)


        I tried adding the groupId and artifactId to the lifecycle mapping
        declaration but don't know that it helped...  I haven't been able to
        reproduce the NPE or resolve the complaints about lack of lifecycle
        information in the POM editor...

        Am I doing something wrong?

        Thanks.

        Keith

        On Wed, Aug 29, 2012 at 1:22 PM, Igor Fedorenko
        <igor@xxxxxxxxxxxxxx <mailto:igor@xxxxxxxxxxxxxx>
        <mailto:igor@xxxxxxxxxxxxxx <mailto:igor@xxxxxxxxxxxxxx>>> wrote:



             On 12-08-29 1:01 PM, Keith Barlow wrote:

                 The plugin is a customized xjc plugin so if I
        understand you
                 correctly,
                 I have two options:

                 1.) Configure it for execute which requires adding code
        which
                 uses the
                 plexus-build-api to make workspace changes.  (e.g. I
        could have the
                 generated files added to the build path if desired or I
        could
                 just leave
                 that as a manual task but would still need a no-op
                 implementation to be
                 executed).


             Assuming the goal is to have generated files visible as
        java sources in
             workspace, the mapping needs to

             runOnConfiguration=true, such that source root folders
        added by the
             plugin are created as Eclipse java project source folders.
        This does not
             require use of BuildContext

             runOnIncremental can be either true of false.
        runOnIncremental=false
             does not require use of BuildContext either, but source
        code will only
             be (re)generated during full/clean workspace build and will
        require
             manual project refresh. For automatic generation of sources,
             runOnIncremental=true and use of BuildContext is required



                 2.) Add it as ignore which would suppress all error
        messages and
                 prevent
                 the plugin from being executed unless I actually do a
        maven build.
                 (which is essentially what happens now only I do get error
                 messages.)


             This will completely ignore the plugin in Eclipse. You will
        need to
             create java source folders in Eclipse and run the code
        generation
             manually.

             --
             Regards,
             Igor

                 Is that correct?

                 (Thanks in advance.)

                 Keith

                 On Wed, Aug 29, 2012 at 12:43 PM, Igor Fedorenko
                 <igor@xxxxxxxxxxxxxx <mailto:igor@xxxxxxxxxxxxxx>
        <mailto:igor@xxxxxxxxxxxxxx <mailto:igor@xxxxxxxxxxxxxx>>
                 <mailto:igor@xxxxxxxxxxxxxx
        <mailto:igor@xxxxxxxxxxxxxx> <mailto:igor@xxxxxxxxxxxxxx
        <mailto:igor@xxxxxxxxxxxxxx>>>> wrote:

                      If your maven plugin can safely participate Eclipse
                 incremental build,
                      which in practice means it can either be safely
        ignored or
                 plugin code
                      uses plexus BuildContext to negotiate changes, the
        mapping
                 metadata can
                      be embedded in maven plugin itself. See [1] for
        more details.

                      If mapping requires Eclipse-specific logic not
        currently
                 achievable
                      through BuildContext, then you need to write an
        Eclipse
                 plugin that
                      provides the implementation of the logic and
        mapping xml file.

                      [1]
        http://wiki.eclipse.org/M2E_______compatible_maven_plugins
        <http://wiki.eclipse.org/M2E_____compatible_maven_plugins>


        <http://wiki.eclipse.org/M2E_____compatible_maven_plugins
        <http://wiki.eclipse.org/M2E___compatible_maven_plugins>>



          <http://wiki.eclipse.org/M2E_____compatible_maven_plugins
        <http://wiki.eclipse.org/M2E___compatible_maven_plugins>
                 <http://wiki.eclipse.org/M2E___compatible_maven_plugins
        <http://wiki.eclipse.org/M2E_compatible_maven_plugins>>>

                      --
                      Regards,
                      Igor


                      On 12-08-29 12:31 PM, Keith Barlow wrote:

                          Hiyas,

                          We have a customized maven plugin we use in
        our company
                 which
                          doesn't
                          have lifecycle mapping metadata for it...  How
        do I add
                 a local
                          entry to
                          the new Lifecycle Mappings preferences feature
        in m2e?
                   I looked
                          at the
                          developer documentation for extension
        development and
                 it defines a
                          lifecycle mapping xml blob but it looks like
        that needs
                 to point
                          to some
                          kind of configurator class...  is that
        required for
                 local entries?
                             where would it live?

                          Thanks.

                          Keith

                          --
                          Keith Barlow

                          /Software Engineer/
                          *Dell Boomi*




          _____________________________________________________


                          m2e-users mailing list
        m2e-users@xxxxxxxxxxx <mailto:m2e-users@xxxxxxxxxxx>
        <mailto:m2e-users@xxxxxxxxxxx <mailto:m2e-users@xxxxxxxxxxx>>
                 <mailto:m2e-users@xxxxxxxxxxx
        <mailto:m2e-users@xxxxxxxxxxx> <mailto:m2e-users@xxxxxxxxxxx
        <mailto:m2e-users@xxxxxxxxxxx>>__>
        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>
        <mailto:m2e-users@xxxxxxxxxxx <mailto:m2e-users@xxxxxxxxxxx>>
                 <mailto:m2e-users@xxxxxxxxxxx
        <mailto:m2e-users@xxxxxxxxxxx> <mailto:m2e-users@xxxxxxxxxxx
        <mailto:m2e-users@xxxxxxxxxxx>>__>
        https://dev.eclipse.org/______mailman/listinfo/m2e-users
        <https://dev.eclipse.org/____mailman/listinfo/m2e-users>
                 <https://dev.eclipse.org/____mailman/listinfo/m2e-users
        <https://dev.eclipse.org/__mailman/listinfo/m2e-users>>



          <https://dev.eclipse.org/____mailman/listinfo/m2e-users
        <https://dev.eclipse.org/__mailman/listinfo/m2e-users>
                 <https://dev.eclipse.org/__mailman/listinfo/m2e-users
        <https://dev.eclipse.org/mailman/listinfo/m2e-users>>>




                 --
                 Keith Barlow

                 /Software Engineer/
                 *Dell Boomi*



                 ___________________________________________________
                 m2e-users mailing list
        m2e-users@xxxxxxxxxxx <mailto:m2e-users@xxxxxxxxxxx>
        <mailto:m2e-users@xxxxxxxxxxx <mailto:m2e-users@xxxxxxxxxxx>>
        https://dev.eclipse.org/____mailman/listinfo/m2e-users
        <https://dev.eclipse.org/__mailman/listinfo/m2e-users>
                 <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>
        <mailto:m2e-users@xxxxxxxxxxx <mailto:m2e-users@xxxxxxxxxxx>>
        https://dev.eclipse.org/____mailman/listinfo/m2e-users
        <https://dev.eclipse.org/__mailman/listinfo/m2e-users>
             <https://dev.eclipse.org/__mailman/listinfo/m2e-users
        <https://dev.eclipse.org/mailman/listinfo/m2e-users>>




        --
        Keith Barlow

        /Software Engineer/
        *Dell Boomi*



        _________________________________________________
        m2e-users mailing list
        m2e-users@xxxxxxxxxxx <mailto:m2e-users@xxxxxxxxxxx>
        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>
    https://dev.eclipse.org/__mailman/listinfo/m2e-users
    <https://dev.eclipse.org/mailman/listinfo/m2e-users>




--
Keith Barlow

/Software Engineer/
*Dell Boomi*



_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users

_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users



--
Keith Barlow

Software Engineer
Dell Boomi


Back to the top