When automating Eclipse's “Export as Feature”, Maven/Tycho doesn't see my plugin

后端 未结 1 616
夕颜
夕颜 2021-01-06 16:54

I have a plugin and a feature project in my workspace. When I export the feature manually via File > Export As > Feature everything works well. I\'m trying to write an autom

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-06 17:50

    So far, your configuration looks good. However you currently only have an automated build for your feature, but not the for the plugin. Unlike the Eclipse export wizard, eclipse-feature only processes the feature.xml - and it expects that the referenced plugins are built elsewhere.

    So what you need to do is to set up a Maven reactor which includes both an eclipse-feature and an eclipse-plugin project. Here is how you do this:

    1. Make your current pom.xml the parent POM: Change the packaging to pom, adapt the artifactId to something which makes sense (e.g. MyProject.parent), and move the pom.xml into a new general project in your workspace.
    2. Add a pom.xml in the root of the feature project:

      
        4.0.0
      
        
          MyProject
          MyProject.parent
          1.0.0-SNAPSHOT
          relative/path/to/parent/project
        
      
        NMGDBPluginFeature
        eclipse-feature
      
      
      
    3. Add another pom.xml in the root of the plugin project, which is the same as the one above except for the artifactId - this needs to be the same as the plugin's Bundle-SymbolicName - and the packaging which needs to be eclipse-plugin.

    4. Include the plugin and feature projects in the Maven reactor by adding a section in the parent POM with the paths to these projects:

        
          relative/path/to/plugin/project
          relative/path/to/feature/project
        
      

    Note that the paths need to be adapted so that they are correct for the project locations on disk (which may be different to what is shown in the Eclipse workspace). The paths need to be relative, so they probably start with ../.

    Now you can trigger a Maven build on your parent POM, and the feature should be able to resolve the reference to your plugin. In Eclipse, you can trigger the Maven build from the context menu of the pom.xml file. Or, if you also convert the parent project to a Maven project, the you can also run Maven builds from the context menu of the project root.

    0 讨论(0)
提交回复
热议问题