![](/img/trans.png)
[英]Eclipse cannot find dependencies of a plugin built with Maven Tycho
[英]Handling dependencies of an Eclipse plugin built with Tycho, using a Target Platform
我正在用Tycho開發一個Eclipse插件,我想按照本教程中描述的步驟使用目標平台來處理我的依賴項。 但是,當我嘗試編譯插件項目(使用全新安裝)時,出現以下錯誤:
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: com.codeandme.tycho.plugin 1.0.0.qualifier
[ERROR] Missing requirement: com.codeandme.tycho.plugin 1.0.0.qualifier requires 'bundle org.eclipse.ui 0.0.0' but it could not be found
這是我的插件項目的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>
<artifactId>com.codeandme.tycho.plugin</artifactId>
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>tycho_example</groupId>
<artifactId>com.codeandme.tycho.releng</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../com.codeandme.tycho.releng</relativePath>
</parent>
</project>
這是父項目(releng)的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>tycho_example</groupId>
<artifactId>com.codeandme.tycho.releng</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<tycho.version>0.22.0</tycho.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<!-- enable tycho build extension -->
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
<target>
<artifact>
<groupId>tycho_example</groupId>
<artifactId>com.codeandme.tycho.releng.targetplatform</artifactId>
</artifact>
</target>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
<modules>
<module>../com.codeandme.tycho.plugin</module>
<module>../com.codeandme.tycho.releng.targetplatform</module>
</modules>
</project>
這是我的目標平台的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>
<artifactId>com.codeandme.tycho.releng.targetplatform</artifactId>
<packaging>eclipse-target-definition</packaging>
<parent>
<groupId>tycho_example</groupId>
<artifactId>com.codeandme.tycho.releng</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../com.codeandme.tycho.releng</relativePath>
</parent>
<groupId>tycho_example</groupId>
</project>
最后是目標平台的.tpd:
target "Tycho Tutorial"
with source requirements
location "http://download.eclipse.org/tools/orbit/downloads/drops/R20150519210750/repository/" mars-orbit {
org.apache.commons.lang3
}
location "http://download.eclipse.org/releases/mars" mars-release {
org.eclipse.platform.feature.group
org.eclipse.equinox.executable.feature.group
org.eclipse.e4.rcp.feature.group
org.eclipse.ui.trace
org.eclipse.pde.feature.group
}
任何幫助將不勝感激。
在目標定義中,您包括了org.eclipse.e4.rcp.feature.group
,而原始教程要求您包括org.eclipse.rcp.feature.group
。 這就是缺少UI捆綁包的原因。
您可以輕松地檢查目標平台的實際內容:右鍵單擊.tpd
文件,選擇“生成目標定義”,打開新生成的.target
文件,等待Eclipse對其進行解析(觀看進度視圖),然后單擊它。解決后,目標編輯器的“內容”頁面顯示該目標平台中可用的插件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.