无法在 pom.xml 中使用 Tycho 1.0.0 解析 "eclipse-plugin" 包装类型
Unable to resolve "eclipse-plugin" packaging type with Tycho 1.0.0 in pom.xml
我正在尝试构建一个 Eclipse 插件。我正在使用 Tycho 1.0.0 将带有 <packaging>eclipse-plugin</packaging>
的 jar 打包。 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
Build <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>
我正在尝试构建一个 Eclipse 插件。我正在使用 Tycho 1.0.0 将带有 <packaging>eclipse-plugin</packaging>
的 jar 打包。 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
Build <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>