1

I have a question concerning Maven3. I want to create a JAR File with the name myJarFile_1.0.0-SNAPSHOT_200140723.jar.

But Maven only create the follwoing name (I used the command "mvn clean install"): myJarFile_1.0.0-SNAPSHOT_200140723-jar-with-dependencies.jar

Here is my finalName declaration:

<finalName>${project.artifactId}_${project.version}_${timestamp}</finalName>

Here is the configuration of my Maven-asembly-plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
            <descriptorRefs>
                <descriptorRef>
                    jar-with-dependencies
                </descriptorRef>
            </descriptorRefs>
            <archive>
                <addMavenDescriptor>false</addMavenDescriptor>
                <manifestEntries>
                    <source-jdk>1.6</source-jdk>
                    <target-jdk>1.6</target-jdk>
                </manifestEntries>
                <manifest>
                    <addClasspath>true</addClasspath>
                    <classpathPrefix>lib/</classpathPrefix>
                    <mainClass>myMainClass</mainClass>
                </manifest>
            </archive>
        </configuration>
        <executions>
            <execution>
                <id>assembly-jar-Id</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

How can i solve this problem?

I can only work with the JAR File, which includes the text "jar-with dependencies". But i must rename this file, because of my bash sell script, which execute this File. The second JAR file, which was created by maven, can not be used, since i get this error message: no main manifest attribute, in myJarFile.jar

Many thanks !

  • You should have _both_ artifacts as the assembly plugin _only adds_ the jar-with-dependencies artifact. – Seelenvirtuose Jul 23 '14 at 12:28
  • possible duplicate of [Controlling maven final name of jar artifact](http://stackoverflow.com/questions/4238944/controlling-maven-final-name-of-jar-artifact) – tostao Jul 23 '14 at 12:30
  • You are right, but the jar file without the describtion "jar-with-dependencies" doesn´t work correct –  Jul 23 '14 at 12:33
  • Why would you like to change the name? What is the intention of such a complex configuration only for changing the name? – khmarbaise Jul 23 '14 at 22:31
  • I can only work with the JAR File, which includes the text "jar-with dependencies". But i must rename this file, because of my bash sell script, which execute this File. The second JAR file, which was created by maven, can not be used, since i get this error message: no main manifest attribute, in myJarFile.jar –  Jul 24 '14 at 06:33

0 Answers0