![](/img/trans.png)
[英]Upgraded from Eclipse RCP 3.x to 4.x: org.eclipse.e4.core.di.InjectionException: org.eclipse.swt.SWTException: Invalid thread access
[英]eclipse RCP maven/tycho missing requirement 'bundle org.eclipse.e4.core.di'
有一个Eclipse RCP / IDE-Plug-in项目,它依赖于多个Eclipse模块,例如org.eclipse.e4.core.di
或org.eclipse.core.runtime
。
该项目在Eclipse IDE的Committers环境中进行编译,并带有.target
文件以进行依赖项设置。
我想为此项目添加无头Maven / tycho构建,导致出现如下错误:
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: org.myplugin.someservice 1.0.0
[ERROR] Missing requirement: org.myplugin.someservice 1.0.0 requires 'bundle org.eclipse.e4.core.di 0.0.0' but it could not be found
项目设置如下所示:
releng/
org.myplugin.releng/
pom.xml (contains tycho-plugins def, modules, target ref)
org.myplugin.target/
Neon.target
pom.xml (contains 'eclipse-target-definition')
plugins/
org.myplugin.someservice/
pom.xml
META-INF/
MANIFEST.MF (contains reference to org.eclipse.e4.core.di)
我使用了Lars Vogel的教程( http://www.vogella.com/tutorials/EclipseTycho/article.html#exercise-using-a-target-platform-for-the-build )进行基本设置和理解。
目标文件的内容是:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?><target name="Neon" sequenceNumber="43">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="false" type="InstallableUnit">
<unit id="org.eclipse.platform.sdk" version="4.6.3.M20170301-0400"/>
<unit id="org.eclipse.pde.feature.group" version="3.12.3.v20170301-0400"/>
<unit id="org.eclipse.pde.source.feature.group" version="3.12.3.v20170301-0400"/>
<unit id="org.eclipse.platform.ide" version="4.6.3.M20170301-0400"/>
<unit id="org.eclipse.equinox.sdk.feature.group" version="3.12.0.v20170209-1843"/>
<unit id="org.eclipse.rcp.feature.group" version="4.6.3.v20170301-0400"/>
<repository location="http://download.eclipse.org/eclipse/updates/4.6"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="false" type="InstallableUnit">
<unit id="org.eclipse.emf.cdo.epp.feature.group" version="4.5.0.v20160607-1511"/>
<unit id="org.eclipse.emf.sdk.feature.group" version="2.12.0.v20160526-0356"/>
<unit id="org.eclipse.emf.compare.diagram.papyrus.feature.group" version="3.2.1.201608311750"/>
<unit id="org.eclipse.xtext.sdk.feature.group" version="2.10.0.v201605250459"/>
<unit id="org.eclipse.gmf.runtime.sdk.feature.group" version="1.10.0.201606071959"/>
<unit id="org.eclipse.gmf.runtime.notation.sdk.feature.group" version="1.10.0.201606071631"/>
<unit id="org.eclipse.uml2.sdk.feature.group" version="5.2.3.v20170227-0935"/>
<unit id="org.eclipse.emf.compare.ide.ui.feature.group" version="3.2.1.201608311750"/>
<repository location="http://download.eclipse.org/releases/neon"/>
</location>
</locations>
</target>
这主要捕获了我的Eclipse Installation Information打印出的有关已安装软件的内容。
target/pom.xml
如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.myplugin</groupId>
<artifactId>org.myplugin.releng</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../org.myplugin.releng/pom.xml</relativePath>
</parent>
<groupId>org.myplugin</groupId>
<artifactId>org.myplugin.target</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-target-definition</packaging>
</project>
releng/pom.xml
很大,它指定了所有maven / tycho插件,要用于依赖性解析的目标文件,目标平台以及所有作为模块的插件和功能。
对于一个失败的插件,pom.xml文件如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.myplugin</groupId>
<artifactId>org.myplugin.releng</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../org.myplugin.releng/pom.xml</relativePath>
</parent>
<groupId>org.myplugin</groupId>
<artifactId>org.myplugin.someservice</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
我在stackoverflow上阅读了许多类似的问题,并尝试了许多修复方法:
没事。 那我在这里想念什么?
编辑:据我了解, releng/pom.xml
应该设置tycho插件和Maven东西。 然后,在releng/pom.xml
指定的Neon.target定义使用target/pom.xml
和target/Neon.target
来获取Eclipse Environment(包括org.eclipse.e4.core.di
执行mvn clean verfiy
命令应该可以构建解决方案org.eclipse.e4.core.di
和org.eclipse.core
内容)以及任何进一步定义的依赖项。
EDIT2:我的eclipse-target-definition
插件的配置如下:
<profile>
<id>Neon.target</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<xtext-version>2.10.0</xtext-version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<includePackedArtifacts>true</includePackedArtifacts>
<target>
<artifact>
<groupId>org.myplugin</groupId>
<artifactId>org.myplugin.target</artifactId>
<version>1.0.0-SNAPSHOT</version>
<classifier>org.myplugin.target</classifier>
</artifact>
</target>
</configuration>
</plugin>
</plugins>
</build>
</profile>
EDIT3:我正在使用Tycho版本1.0.0
EDIT4修复了target/pom.xml
的拼写错误。
您需要使用-P Neon.target
运行Maven才能激活您的<profile>
; 否则,您的target-platform-configuration
将不属于该构建。
就个人而言,我总是在任何<profile>
之外有一个默认的target-platform-configuration
。 例如,这可能是Eclipse当前版本的目标定义(撰写本文时:Oxygen)。 我只会将`用于不寻常的目标定义,例如较早的Eclipse版本(在您的情况下:Neon)。 但这只是我个人的最佳做法。
其实我解决了我的问题,但不像我期望的那样。 我认为它不应该工作,但是现在它是这样工作的:
我根据此问题的答案将以下配置添加到org.myplugin.releng/pom.xml
父pom中:
<repositories>
<repository>
<id>neon</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/neon/</url>
</repository>
</repositories>
我以前做过,但是错过了我在pom.xml中的其他地方已经有一个存储库部分,这导致它失败并在我的怒火中迷失了那条路:D
实际上,我仍然相信它应该从目标文件中获取该信息。 我注意到在成功构建过程中, 目标文件是在父pom之后进行评估的,从而导致在处理目标定义文件之前,它需要所有依赖项。
我敢打赌我的配置仍然有问题,但至少现在可以构建了。 如果有人有任何想法,尽管它会让我感到满意:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.