首页 > 解决方案 > Maven 内部错误:org.eclipse.tycho.core.osgitools.OsgiManifestParserException:异常解析 OSGi MANIFEST

问题描述

我正在为少数 dsl (xtext) 类型的项目配置 maven。我配置了 dsl1 (xtext) 插件所需的所有内容,它成功运行(生成 java 源代码、构建、运行测试、导出、生成 P2)。

然后,我为我的下一个 dsl2 插件移动了相同的 pom.xml 配置,它们几乎相同并且出现了问题:

[ERROR] Failed to execute goal org.eclipse.xtext:xtext-maven-plugin:2.16.0.M1:generate (default) on project com.dsl.dsl2: Execution default of goal org.eclipse.xtext:xtext-maven-plugin:2.16.0.M1:generate failed: Plugin org.eclipse.xtext:xtext-maven-plugin:2.16.0.M1 or one of its dependencies could not be resolved: Could not find artifact com.dsl.dsl2:com.dsl.dsl2:jar:0.1.0-SNAPSHOT 

运行的插件是com.dsl.dsl2,它告诉它找不到自己。事实上,由于某种原因,maven 未能将其复制到相应的.m2/repository位置。我尝试了不同的解决方案来解决它,其中之一是删除整个~/.m2/repository并重新生成它。但是现在,我没有解决我的问题,而是面临着其他不同的问题。

对于我之前运行的所有存储库mvn clean verify,现在都抱怨相同的错误:

[INFO] Resolving class path of MavenProject: com.dsl.dsl2:com.dsl.dsl2:1.1.1-SNAPSHOT @ /<my_path>/<my_repo>/com.dsl.dsl2/pom.xml
[ERROR] Internal error: org.eclipse.tycho.core.osgitools.OsgiManifestParserException: Exception parsing OSGi MANIFEST ~/.m2/repository/p2/osgi/bundle/org.eclipse.xtext.xtext.generator/2.15.0.v20180916-0722/org.eclipse.xtext.xtext.generator-2.15.0.v20180916-0722.jar: zip file is empty -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: org.eclipse.tycho.core.osgitools.OsgiManifestParserException: Exception parsing OSGi MANIFEST ~/.m2/repository/p2/osgi/bundle/org.eclipse.xtext.xtext.generator/2.15.0.v20180916-0722/org.eclipse.xtext.xtext.generator-2.15.0.v20180916-0722.jar: zip file is empty
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:120)
    ...
Caused by: org.eclipse.tycho.core.osgitools.OsgiManifestParserException: Exception parsing OSGi MANIFEST ~/.m2/repository/p2/osgi/bundle/org.eclipse.xtext.xtext.generator/2.15.0.v20180916-0722/org.eclipse.xtext.xtext.generator-2.15.0.v20180916-0722.jar: zip file is empty
    at org.eclipse.tycho.core.osgitools.DefaultBundleReader.doLoadManifest (DefaultBundleReader.java:68)
    ...
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.util.zip.ZipException: zip file is empty
    at java.util.zip.ZipFile.open (Native Method)
    ...

我最感兴趣的是首先解决最后一个问题。jar 文件似乎是正确的:

% ls -lsa ~/.m2/repository/p2/osgi/bundle/org.eclipse.swt.gtk.linux.x86/3.105.3.v20170228-0512/
2568 <user> 2616403  org.eclipse.swt.gtk.linux.x86-3.105.3.v20170228-0512.jar
   4 <user> 219      org.eclipse.swt.gtk.linux.x86-3.105.3.v20170228-0512-p2artifacts.xml

而且我不知道为什么它使用我在 pom.xml 属性中指定的 xtext 2.15.0

<xtend.version>2.16.0.M1</xtend.version>
<xtext.version>2.16.0.M1</xtext.version>

我的行家:

% mvn -version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T21:33:14+03:00)
Maven home: ~/maven/apache-maven-3.5.4
Java version: 1.8.0_45, vendor: Oracle Corporation, runtime: 
Default locale: en_US, platform encoding: ISO-8859-1
OS name: "linux", version: "2.6.32-642.11.1.el6.x86_64", arch: "amd64", family: "unix"

我正在使用代理。

更新

那就是它抱怨的解压缩jar的内容。

% ls  /org.eclipse.swt.gtk.linux.x86-3.105.3.v20170228-0512
about_files  fragment.properties     libswt-cairo-gtk-4629.so  libswt-gtk-4629.so          libswt-pi-gtk-4629.so         libswt-xulrunner-fix10.so     META-INF  swt.xpt
about.html   libswt-atk-gtk-4629.so  libswt-glx-gtk-4629.so    libswt-mozilla-gtk-4629.so  libswt-webkit-gtk-4629.so     libswt-xulrunner-fix31.so     org       version.txt
chrome.manifest  libswt-awt-gtk-4629.so  libswt-gnome-gtk-4629.so  libswt-pi3-gtk-4629.so      libswt-xpcominit-gtk-4629.so  libswt-xulrunner-gtk-4629.so  swt.js

我正在使用简单的目标平台配置:

    <repository>
        <id>xtext</id>
        <url>http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/</url>
        <layout>p2</layout>
    </repository>
    <repository>
        <id>eclipse</id>
        <url>http://download.eclipse.org/releases/neon/201705151400/</url>
        <layout>p2</layout>
    </repository>

更新

我已经解决了我的问题,但我不能说这是我遇到的问题的解决方案。

基本上,我不再使用任何<artifactId>xtext-maven-plugin</artifactId>失败的东西,如果需要,建议在非 Eclipse 插件中使用它。我不需要它。

标签: javamavendslxtexttycho

解决方案


推荐阅读