使用eclipse-plugin包装将java插件转换成maven项目 [英] Convert java plugin into maven project with eclipse-plugin packaging

查看:2017
本文介绍了使用eclipse-plugin包装将java插件转换成maven项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对java很有经验,但是我第一次使用maven。
i已经安装了Eclipse Kepler(Eclipse for RCP和RAP Developers),我已经安装了Tychus以及添加新软件按钮。



有一个物联网项目我克隆并建成了OM2M。
我一步步跟随安装wiki,一切正常工作。
在这里克隆wiki



我想开发自己的OSGI模块,所以我去了维基的'开发者'部分,并再次创建了一个新的插件项目。
当我尝试将此插件项目转换为maven项目(链接到步骤i我在谈论)我不需要eclipse-plugin包装类型为我的pom 维基屏幕截图这里



我在网路上看了一下,显然它与需要配置的Tychus有关,我试着打字在框中,但显然我有问题,当我尝试构建,我尝试编辑主要的pom.xml与我发现的东西,但没有一个工作,我真的不知道该怎么做,使其工作。



你们有想法吗?
谢谢



编辑:我忘了提到我读了这个线程,但我不明白答案,我不知道把代码放在哪里,顶部的答案是在谈论,也不知道在哪里,但OSGI显示。



编辑2:pom.xml当我进入eclipse-plugin时,我得到:
如果我手写这个eclipse-plugin是我的pom .xml:

 < project xmlns =http://maven.apache.org/POM/4.0.0xmlns :xsi =http://www.w3.org/2001/XMLSchema-instancexsi:schemaLocation =http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ XSD /行家-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>

编辑3:我设法通过将主pom.xml设置为父级,但现在删除错误当我尝试构建我有以下错误:

  [ERROR]无法执行目标org.eclipse.tycho:tycho-包装插件:0.20.0:项目org.eclipse.om2m.sample.ipu上的validate-version(default-validate-version):不合格的OSGi版本1.0.0.qualifier必须匹配不合格的Maven版本0.0.1-SNAPSHOT for SNAPSHOT构建 - > 

我已经搜索了目标,但我不知道在哪里设置或编辑它们。 / p>

编辑4:感谢@Wim Anckaert我已经从pom.xml和清单中删除了.qualifier和.snapshot,现在它似乎正在运行!
感谢很多人。

解决方案

最后一个错误似乎是< 版本的问题您的./META-INF/MANIFEST.MF文件的./pom.xml和 Bundle-Version 。这些应该是相等的。



我们的pom.xml的一部分:

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

我们的MANIFEST.MF的一部分

  Bundle-Name:CERPS 
Bundle-SymbolicName:be.cs.fashion.awg.core; singleton:= true
Bundle-Version:2.1.0
Bundle本地化:插件

所以在你的情况下,在pom.xml版本中的版本应该是1.0 .0-SNAPSHOT或者你应该使用Bundle-Version0.0.1.qualifier
我们在我们的版本中删除了-SNAPSHOT和.qualifier。


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.

解决方案

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.

这篇关于使用eclipse-plugin包装将java插件转换成maven项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆