0
  <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>org.jboss.tools</groupId>
            <artifactId>example</artifactId>
            <packaging>war</packaging>
            <version>0.0.1-SNAPSHOT</version>
            <name>example</name>
        <properties>
                <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            </properties>
<build>
        <finalName>example</finalName>
            <pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.3</version>
                        <configuration>
                            <source>1.8</source>
                            <target>1.8</target>
                            <compilerArguments>
                                <endorseddirs>${endorsed.dir}</endorseddirs>
                            </compilerArguments>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <version>2.6</version>
                        <configuration>
                        <warName>example.war</warName>
                            <failOnMissingWebXml>true</failOnMissingWebXml>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>2.10</version>
                        <executions>
                            <execution>
                                <phase>validate</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${endorsed.dir}</outputDirectory>
                                    <silent>true</silent>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>javax</groupId>
                                            <artifactId>javaee-endorsed-api</artifactId>
                                            <version>7.0</version>
                                            <type>jar</type>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </pluginManagement>
        </build>

I am using above code configuration for my project . But when I build my project by eclipse it deploy project as : example-0.0.1-SNAPSHOT . I did not understand why -0.0.1-SNAPSHOT append after my project name ? I update my build .But I still getting same error.

Kaustubh
  • 64
  • 1
  • 7
  • Possible duplicate of [Controlling maven final name of jar artifact](http://stackoverflow.com/questions/4238944/controlling-maven-final-name-of-jar-artifact) – Radouane ROUFID Jul 12 '16 at 09:23
  • @RadouaneROUFID: the answer you suggest is quite dated and not quite on topic. I think the answer below is a definite improvement – Steve C Jul 12 '16 at 14:07

1 Answers1

6

This is the default name defined by finalName property. If you don't define this property, the defaut value is :

<build>
    <directory>${project.basedir}/target</directory>
    <outputDirectory>${project.build.directory}/classes</outputDirectory>
    <finalName>${project.artifactId}-${project.version}</finalName>

Documentation : https://maven.apache.org/pom.html

EDIT

Also, you should not use <pluginManagement> in this simple case. So, in this case, you should organize your pom.xml as follow :

<project>
  <build>
    <finalName>...</finalName>
    <plugins>...</plugins>
  </build>
</project>
Mickael
  • 4,458
  • 2
  • 28
  • 40