【发布时间】:2021-11-14 08:54:40
【问题描述】:
我很沮丧。我花了很长时间尝试使用 Maven shade 插件将 Maven 项目编译成 Uber/Fat jar 文件,但我仍然在命令提示符下不断收到“mvn 未被识别为内部或外部命令”错误。以下是我的 pom.xml 的重要部分:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>*my main class*</mainClass>
</transformer>
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
我不知道我做错了什么。我将使用 Windows 命令提示符进入我的项目目录并输入“mvn clean install”,但它似乎不起作用。我是 Maven 新手,我通常使用 Gradle。插件没有加载?难道我做错了什么?还是我只是像往常一样愚蠢?
任何帮助表示赞赏!提前致谢!
【问题讨论】:
-
“mvn 未被识别为内部或外部命令”意味着它不能通过 Windows 命令提示符使用...
-
我知道,但是如果我不能通过命令提示符执行此操作,我应该怎么做呢?我使用 Eclipse IDE,所以我尝试了终端功能,但它提供了相同的功能。
标签: java maven maven-shade-plugin