如何解决Maven"此项目的包装没有将文件分配给构建工件"错误?

时间:2015-04-24 13:36:40

标签: maven maven-3 maven-war-plugin maven-install-plugin

我正在使用Maven 3.2.3。我以前能够在我的WAR项目上运行“mvn clean install”,WAR将安装到我的本地存储库。但是,我最近添加了一个配置,以便我的WAR可以在适当的位置构建(配置在下面)。现在,当我跑

mvn clean install

我收到错误

[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]

我该如何解决这个问题?我尝试将maven-install-plugin的“安装”目标作为默认目标,但这没有帮助。以下是我的Maven配置......

                <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>

1 个答案:

答案 0 :(得分:-1)

添加以下rpm条目

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

在这里提到的以下每个文件中解决了我的问题。 (从64到无拱门)。

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