无法在pom.xml中使用Tycho 1.0.0解析“eclipse-plugin”打包类型

时间:2018-01-09 14:49:52

标签: java eclipse maven eclipse-plugin tycho

我正在尝试构建一个Eclipse插件。我正在使用Tycho 1.0.0将jar包装为<packaging>eclipse-plugin</packaging>。 Maven给我错误“Unknown packaging:eclipse-plugin”。在搜索时我遇到this SO post没有帮助。

这是我的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>My_Plugin</groupId>
<artifactId>My_Plugin</artifactId>
<version>0.0.0</version>
<packaging>eclipse-plugin</packaging>

<properties>
    <TYCHO.VERSION>1.0.0</TYCHO.VERSION>
</properties>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-maven-plugin</artifactId>
                <version>${TYCHO.VERSION}</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

这是我的MANIFEST.MF

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: My Plugin
Bundle-SymbolicName: My_Plugin;singleton:=true
Bundle-Version: 0.0.0
Bundle-Activator: com.myplugin.Activator
Bundle-Vendor: MYPLUGIN
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime,
 org.eclipse.ui.editors,
 org.eclipse.ui.ide,
 org.eclipse.core.resources,
 org.eclipse.ui.workbench.texteditor,
 org.eclipse.jface.text
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: com.myplugin.mypackages

1 个答案:

答案 0 :(得分:1)

构建<extensions>必须在project/build/plugins下方声明,而不是在project/build/pluginManagement/plugins下面(或者,如果您愿意,请在project/build/extensions下方)。因此,以下修复了该问题并注册了eclipse-plugin包装:

<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-maven-plugin</artifactId>
            <version>${TYCHO.VERSION}</version>
            <extensions>true</extensions>
        </plugin>
    </plugins>
</build>