1

I am trying to include a jar from the repository but I want to rename the jar when I use it.

Currently I am doing like

  <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <configuration>
                            <finalName>test</finalName>
                            <includes>
                                <include>original-jar-name</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

But there is no effect of the above. I have already taken help from : Maven - How to rename the output classifier of a jar name?

Controlling maven final name of jar artifact

Is it possible to rename a maven jar-with-dependencies?

But that did not worked.

How is it achievable ?

Deep
  • 929
  • 2
  • 16
  • 32
  • What do you mean by "when I use it"? Are you building a WAR or EAR file? Or is there a different place where you want to "use" the jar? – J Fabian Meier Mar 31 '20 at 06:21
  • I am trying to use it in a spring boot jar – Deep Mar 31 '20 at 09:28
  • Then I would look for options in the spring boot maven plugins to change the file name. WAR and EAR plugins have such options. – J Fabian Meier Mar 31 '20 at 09:41
  • Why do you need to rename it? Does not make sense? in particular in a Spring Boot App ...The above configuration could have any effect cause [maven-jar-plugin](https://maven.apache.org/plugins/maven-jar-plugin/jar-mojo.html) does not have any kind of configuration like this. Neither `..` and includes is meant for parts of the current build not for dependencies... – khmarbaise Mar 31 '20 at 13:15

0 Answers0