相关文章推荐
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I have an error in my karaf feature project wher I run my mvn install. Here is the 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>

When I run my mvn clean install I get this error:

[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]
                The issue is simply that the karaf plugin does not correctly define the main artifact  see detailed descriptions issues.apache.org/jira/browse/MINSTALL-151 Apart from that it shows that you have not pinned all plugins versions in your build which is by definition bad practice.
– khmarbaise
                Oct 3, 2018 at 8:20
                Thanks!! the problem was the incompatibility between the maven install plugin and the karaf plugin. As it's said in the link you posted, the solution is to change the maven install plugin to the previous version.
– adpoy
                Oct 3, 2018 at 13:29
                This is not really the solution only temporarily. Cause the issue is in karaf-maven-plugin...
– khmarbaise
                Oct 3, 2018 at 15:35

The maven-install-plugin:3.0.0-M1 was released as of 01/10/2018 Since, I got the same error with flexmojos projects where packaging was set to .

Solution is to set the version for the maven-install-plugin to the previous version (2.5.2) explicitly so it won't resolve the version automatically. Note: I had to do this for the maven-deploy-plugin too. There may be others.

<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>
                This doesn't solve the underlying problem and isn't useful unless you want to stay on this exact same version of Maven forever.
– kurczynski
                Dec 14, 2023 at 20:18
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

 
推荐文章