Search code examples
mavenmaven-3pom.xmlmaven-jar-pluginmaven-install-plugin

Maven: The packaging for this project did not assign a file to the build artifact


I'm using Maven 3.0.3 on Mac 10.6.6. I have a JAR project and when I run the command "mvn clean install:install", I'm getting the error,

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install (default-cli) on project StarTeamCollisionUtil: The packaging for this project did not assign a file to the build artifact -> [Help 1]

What does this mean and how can I fix it? Below is my pom.xml. Let me know what other info would be helpful and I'll edit this post. Thanks, - Dave

<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.myco.starteam.util</groupId>
<artifactId>StarTeamCollisionUtil</artifactId>
<packaging>jar</packaging>
<name>StarTeam Collision Util</name>
<version>1.0-SNAPSHOT</version>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
    <repository>
        <id>myco-sonatype-nexus-snapshots</id>
        <name>MyCo Sonatype-Nexus Snapshots</name>
        <url>http://sonatype.myco.com/nexus/content/repositories/snapshots/</url>
    </repository>
</repositories>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.8.1</version>
        </plugin>
    </plugins>
</build>
</project>

Solution

  • I don't know if this is the answer or not but it might lead you in the right direction...

    (I believe these steps are for people working with Intellij IDE. The install:install is available in the Maven panel on the right by default. The below steps are alternative to it.)

    The command install:install is actually a goal on the maven-install-plugin. This is different than the install maven lifecycle phase.

    Maven lifecycle phases are steps in a build which certain plugins can bind themselves to. Many different goals from different plugins may execute when you invoke a single lifecycle phase.

    What this boils down to is the command...

    mvn clean install
    

    is different from...

    mvn clean install:install
    

    The former will run all goals in every cycle leading up to and including the install (like compile, package, test, etc.). The latter will not even compile or package your code, it will just run that one goal. This kinda makes sense, looking at the exception; it talks about:

    StarTeamCollisionUtil: The packaging for this project did not assign a file to the build artifact

    Try the former and your error might just go away!