首页 > 解决方案 > 使用 maven 生成 karaf 功能时出现 NoFileAssignedException 异常

问题描述

运行 mvn 安装时,我的 karaf 功能项目出现错误。这是 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>com.dmasoft.karaf.example</groupId>
    <artifactId>assemblies-parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</parent>

<groupId>com.dmasoft.karaf.example.feature</groupId>
<artifactId>dmasoft-feature</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>feature</packaging>
<name>${project.groupId}/${project.artifactId}:${project.packaging}:${project.version}</name>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.karaf.tooling</groupId>
            <artifactId>karaf-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

当我运行我的 mvn clean install 我得到这个错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install (default-install) on project dmasoft-feature: NoFileAssignedException: The packaging plugin for this project did not assign a main file to the project but it has attachments. Change packaging to 'pom'. -> [Help 1]

标签: mavenapache-karaf

解决方案


maven-install-plugin:3.0.0-M1 自 2018 年 1 月 10 日发布以来,我在包装设置为 .

解决方案是将 maven-install-plugin 的版本显式设置为以前的版本(2.5.2),这样它就不会自动解析该版本。注意:我也必须为 maven-deploy-plugin 执行此操作。可能还有其他人。

<build>
  <plugins>
    <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.5.2</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.8.2</version>
        </plugin>
  </plugins>
</build>

推荐阅读