Convert java plugin into maven project with eclipse-plugin packaging

我的未来我决定 提交于 2019-12-08 07:09:05

问题


I am quite experienced with java but i'm using maven for the first time. i have installed Eclipse Kepler (Eclipse for RCP and RAP Developers), I have installed Tychus as well with the "add new software" button.

There is an Internet of things project that I cloned and built called OM2M. I followed the install wiki step by step and everything work until then. cloning wiki here

I want to develop my own OSGI module so I went to the 'developer' section of the wiki and once again and created a new plugin project. When i try to convert this plugin project into a maven project ( link to the step i'm talking about ) I don't have to "eclipse-plugin" packaging type for my pom wiki screenshot here.

I looked it up on the web and apparently it has something to do with Tychus that needs configuration, I tried typing it in the box but obviously I have problems when i try to build, I tried editing the main pom.xml with stuff I found but none of them work and I really don't know what to do to make it work.

Do you guys have an idea ? Thanks

Edit : i forgot to mention that i read this thread but I don't understand the the answers, I don't know where to put the code the top answer is talking about nor do i know where to but the OSGI manifest.

Edit 2 : pom.xml i get when i enter eclipse-plugin by hands : If i write eclipse-plugin by hand here is my pom.xml :

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.eclipse.om2m</groupId>
  <artifactId>org.eclipse.om2m.sample.ipu</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>eclipse-plugin</packaging>
</project>

Edit 3 : I managed to remove the error by setting the main pom.xml as a parent but now when i try to build i have the following error :

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:0.20.0:validate-version (default-validate-version) on project org.eclipse.om2m.sample.ipu: Unqualified OSGi version 1.0.0.qualifier must match unqualified Maven version 0.0.1-SNAPSHOT for SNAPSHOT builds -> 

I've searched for the goals but I don't know where to set or edit them.

Edit 4 : Thanks to @Wim Anckaert i've dropped the .qualifier and the .snapshot from the pom.xml and the manifest and now it seems to be working ! Thanks a lot guys.


回答1:


The last error seems to be a problem with the <version> of your ./pom.xml and Bundle-Version of your ./META-INF/MANIFEST.MF file. These should be equal to each other.

A part of our pom.xml:

<artifactId>be.cs.fashion.awg.core</artifactId>
<name>CERPS</name>
<version>2.1.0</version>
<packaging>eclipse-plugin</packaging>

A part of our MANIFEST.MF

Bundle-Name: CERPS
Bundle-SymbolicName: be.cs.fashion.awg.core;singleton:=true
Bundle-Version: 2.1.0
Bundle-Localization: plugin

So in your case version in pom.xml version should be "1.0.0-SNAPSHOT" or you should use Bundle-Version "0.0.1.qualifier" We dropped the "-SNAPSHOT" and the ".qualifier" in our versions.




回答2:


The value "eclipse-plugin" is not included in the combo (i.e. the drop-down listbox here), you ought to write it by hand.

Upd: Firstly you must enable tycho. To do this, add

<build>
  <plugins>
    <plugin>
      <groupId>org.eclipse.tycho</groupId>
      <artifactId>tycho-maven-plugin</artifactId>
      <version>0.24.0</version>
      <extensions>true</extensions>
    </plugin>
  </plugins>
</build>

to your pox.xml (or, preferably, to its parent).

Then, you need to know that the wizard you show on screenshot does not search for all possible values of tag, instead it adds to "Packaging" drop-down listbox most usable values and allows you to enter any value that you want.

For more details check out here



来源:https://stackoverflow.com/questions/33789200/convert-java-plugin-into-maven-project-with-eclipse-plugin-packaging

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!