1

I run a Hadoop app with the following pom.xml file. The file contains all the info for creating the JAR file and required dependencies. The file is provided below:

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

When I run the app, it does create the JAR file wordcount.jar in the location,

enter image description here

However, I would like to attach the snapshot version with the JAR name ie. wordcount-0.0.1-SNAPSHOT.jar.

How do I achieve that? I don't have a lot of understanding of the snapshot versioning. I provided the Updated pom.xml file now.

UPDATE

I added the shade plugin but this doesn't solve the issue. Also, there is no JAR in the target directory.

Arefe
  • 11,321
  • 18
  • 114
  • 168

1 Answers1

1

Intellij w/ Maven generates the versioned JAR under target folder

Note: Since you're not using the Shade plugin, then your JAR shouldn't contain the dependencies that you may need

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • There is no JAR in the target folder. Would please have a look in the Storm setup question? I get stuck and seems not many people have the knowledge to advise. – Arefe Aug 18 '18 at 15:58
  • I provided the plugin mentioned but no affect – Arefe Aug 18 '18 at 16:10
  • Well, it should. See https://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven#574650 – OneCricketeer Aug 18 '18 at 17:58
  • Unless you have somehow managed to configure Maven globally on your computer, then that `classes` folder shouldn't exist there – OneCricketeer Aug 18 '18 at 17:59
  • If you want to use Storm JARs, look at https://github.com/apache/storm/tree/master/examples/storm-starter#maven – OneCricketeer Aug 18 '18 at 18:01