首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Maven中的“项目构建错误:未知的打包: eclipse-plugin”

Maven中的“项目构建错误:未知的打包: eclipse-plugin”
EN

Stack Overflow用户
提问于 2018-01-10 06:50:26
回答 1查看 2.4K关注 0票数 1

我有一个maven父程序,在其中我为插件定义了一个模块。

父pom如下所示:

代码语言:javascript
运行
复制
<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>com.angle</groupId>
<artifactId>angle-eclipse</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>

<modules>
    <module>../com.angle.ui</module>
</modules>

<properties>
    <java.version>1.8</java.version>
    <tycho-version>1.0.0</tycho-version>
    <oxygen-repo.url>http://download.eclipse.org/releases/oxygen</oxygen-repo.url>
    <goal.preset>clean install</goal.preset>
</properties>

<repositories>
    <repository>
        <id>oxygen</id>
        <layout>p2</layout>
        <url>${oxygen-repo.url}</url>
    </repository>
</repositories>

<build>
    <!-- <defaultGoal>${goal.preset}</defaultGoal> -->
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-maven-plugin</artifactId>
                <version>${tycho-version}</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

该模块是一个插件,我已经将其特性转换为Maven。

模块的pom.xml如下所示:

代码语言:javascript
运行
复制
<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>
<name>com.angle.ui</name>
<description>UI part of the plug-in</description>

<parent>
    <groupId>com.angle</groupId>
    <artifactId>angle-eclipse</artifactId>
    <version>1.0.0</version>
    <relativePath>../angle-eclipse</relativePath>
</parent>

<artifactId>com.angle.ui</artifactId>   
<packaging>eclipse-plugin</packaging>

现在,尽管我添加了tycho plugin作为构建插件,但它给了我错误:项目构建错误:未知打包:eclipse,而我无法构建maven项目。

没有其他错误存在。

我还搜索了其他帖子,但他们给出的唯一解决方案是将tycho plugin作为构建插件包含在父pom中,而这个方法并不能为我解决问题。

请帮我处理这个。

EN

回答 1

Stack Overflow用户

发布于 2018-01-10 08:19:03

我能够通过将父pom.xml更改为以下代码来解决我的问题:

代码语言:javascript
运行
复制
<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>com.angle</groupId>
<artifactId>angle-eclipse</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>

<modules>
    <module>../com.angle.ui</module>
</modules>

<properties>
    <java.version>1.8</java.version>
    <tycho-version>1.0.0</tycho-version>
    <oxygen-repo.url>http://download.eclipse.org/releases/oxygen</oxygen-repo.url>
    <goal.preset>clean install</goal.preset>
</properties>

<repositories>
    <repository>
        <id>oxygen</id>
        <layout>p2</layout>
        <url>${oxygen-repo.url}</url>
    </repository>
</repositories>

<build>
    <!-- <defaultGoal>${goal.preset}</defaultGoal> -->
    <plugins>
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-maven-plugin</artifactId>
            <version>${tycho-version}</version>
            <extensions>true</extensions>
        </plugin>
    </plugins>
</build>

关键的区别在于,<extension>需要低于project/build/plugins而不是project/build/pluginManagement/plugins。除非在其他地方引用,否则托管插件不会有效;因此,没有启用构建扩展,也没有注册eclipse-plugin打包。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48181775

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档