Dmitriy Ryabin
Dmitriy Ryabin

Reputation: 468

Maven source plugin - change JAR file name

I am converting some projects to maven, from legacy ant builds It so happened, that when we built with Ant, our sources were always called "fileName-src.jar". Now, using maven, I need to keep the same naming.. but it seems that maven-source-plugin sets the name as "fileName-sources.jar" How can I make "-source" not be appended? I am using the finalName in but .. to no avail

 <configuration>
   <finalName>fileName-src</finalName>
   <fileNameMapping>no-version</fileNameMapping>
   <archive>
    <!-- ... manifest entries ...  -->
   </archive>
 </configuration>

As a result of this the jar will named "fileName-src**-source**.jar"

Upvotes: 3

Views: 1299

Answers (1)

glytching
glytching

Reputation: 47865

The default classifier assigned by the Maven Source Plugin is: sources so it will take the JAR's finalName and append -sources.

You can override this by setting the classifier.

For example:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
    <version>3.0.1</version>
    <configuration>
      <classifier>src</classifier>
    </configuration>
  </plugin>

Upvotes: 2

Related Questions