将快照版本名称附加到 JAR 文件
Attach the snapshot version name with the JAR file
我 运行 具有以下 pom.xml
文件的 Hadoop 应用程序。该文件包含用于创建 JAR
文件和所需依赖项的所有信息。文件提供如下:
<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.test.hadoop.wordcount</groupId>
<artifactId>wordcount</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>wordcount</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Hadoop -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.test.hadoop.wordcount.WordCount</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
</plugin>
</plugins>
</build>
</project>
当我 运行 应用程序时,它会在 wordcount.jar
位置创建 JAR 文件,
不过,我想附加带有 JAR 名称的快照版本,即。 wordcount-0.0.1-SNAPSHOT.jar
.
我该如何实现?我对快照版本控制没有太多了解。我现在提供更新的 pom.xml
文件。
更新
我添加了阴影插件,但这并没有解决问题。此外,目标目录中没有 JAR。
带有 Maven 的 Intellij 在目标文件夹下生成版本化的 JAR
注意:由于您没有使用 Shade 插件,因此您的 JAR 不应包含您可能需要的依赖项
我 运行 具有以下 pom.xml
文件的 Hadoop 应用程序。该文件包含用于创建 JAR
文件和所需依赖项的所有信息。文件提供如下:
<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.test.hadoop.wordcount</groupId>
<artifactId>wordcount</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>wordcount</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Hadoop -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.test.hadoop.wordcount.WordCount</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
</plugin>
</plugins>
</build>
</project>
当我 运行 应用程序时,它会在 wordcount.jar
位置创建 JAR 文件,
不过,我想附加带有 JAR 名称的快照版本,即。 wordcount-0.0.1-SNAPSHOT.jar
.
我该如何实现?我对快照版本控制没有太多了解。我现在提供更新的 pom.xml
文件。
更新
我添加了阴影插件,但这并没有解决问题。此外,目标目录中没有 JAR。
带有 Maven 的 Intellij 在目标文件夹下生成版本化的 JAR
注意:由于您没有使用 Shade 插件,因此您的 JAR 不应包含您可能需要的依赖项