How to resolve a Maven "The packaging for this project did not assign a file to the build artifact" error?

Dave picture Dave · Apr 24, 2015 · Viewed 8.9k times · Source

I’m using Maven 3.2.3. I used to be able to run “mvn clean install” on my WAR project and the WAR would get installed to my local repository. However, I recently added a configuration so that my WAR would be constructed in place (config is below). Now, when I run

mvn clean install

I get the error

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

How do I fix this? I tried making the “install” goal of the maven-install-plugin the default, but that didn’t help. Below is my Maven configuration …

                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>2.4.1</version>
                    <configuration>
                        <filesets>
                            <fileset>
                                <directory>${project.basedir}/src/main/webapp/WEB-INF/classes</directory>
                            </fileset>
                            <fileset>
                                <directory>${project.basedir}/src/main/webapp/WEB-INF/lib</directory>
                            </fileset>
                        </filesets>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.6</version>
                    <configuration>
                        <useCache>true</useCache>
                        <workDirectory>/tmp/${project.artifactId}/war/work</workDirectory>
                    </configuration>
                    <executions>
                        <execution>
                            <id>default-war</id>
                            <phase>none</phase>
                        </execution>
                        <execution>
                            <id>war-inplace</id>
                            <phase>package</phase>
                            <goals>
                                <goal>inplace</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.5.2</version>
                    <executions>
                        <execution>
                            <id>default-install</id>
                            <phase>none</phase>
                        </execution>
                        <execution>
                            <id>install</id>
                            <phase>install</phase>
                            <goals>
                                <goal>install</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

Answer

lnarasimhan picture lnarasimhan · Aug 15, 2016

Adding the below rpm entry

    %_rpmfilename noarch/%%{NAME}-%%{VERSION}-%%{RELEASE}.noarch.rpm

in each of the following files mentioned here solved the problem for me. (from 64 to no-arch).

    vim /etc/rpm/macros
    vim ~/.rpmmacros