gpt4 book ai didi

maven - 如何解决 Maven "The packaging for this project did not assign a file to the build artifact"错误?

转载 作者:行者123 更新时间:2023-12-02 05:08:41 32 4
gpt4 key购买 nike

我使用的是 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>

最佳答案

添加以下 rpm 条目

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

这里提到的以下每个文件都为我解决了问题。 (从 64 到无架构)。

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

关于maven - 如何解决 Maven "The packaging for this project did not assign a file to the build artifact"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29848977/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com