Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Copy spring boot packaged fatjar to another directory

Open
#20 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale
Tech stack
spring-boot
Domain
documentation

Research direction

Review the repository's existing programming-tip structure before deciding where this material belongs. Use the Maven install-phase guidance and the three listed copying options as the source, and consider the work done when the fat JAR copying instructions are added in the repository's established format with the relevant command and phase details.

Written by the indexing model from the issue text.

Description

There are at last 3 options to fulfill this case.

Option 1.By maven-resource-plugin:
https://stackoverflow.com/questions/6689511/how-to-place-the-output-jar-into-another-folder-with-maven#comment7915129_6689511

https://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>3.0.2</version>
    <executions>
        <execution>
            <id>copy-files-on-build</id>
            <phase>install</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <outputDirectory>${basedir}/[TO-DIR]</outputDirectory>
                <resources>
                    <resource>
                        <directory>[FROM-DIR]</directory>
                        <!--<include>*.[MIME-TYPE]</include>-->
                        <filtering>false</filtering>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>

Option 2: By maven assembly plugin

https://maven.apache.org/plugins/maven-assembly-plugin/usage.html

        <!-- when running  mvn install , copy my-web.jar to APP-META/docker/config folder automatically(for docker build)  -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>copy-installed</id>
                        <phase>install</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>${project.artifactId}</artifactId>
                                    <version>${project.version}</version>
                                    <type>${project.packaging}</type>
                                    <destFileName>my-web.jar</destFileName>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>../APP-META/docker-config/</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Option 3: By ant run plugin
https://stackoverflow.com/questions/6689511/how-to-place-the-output-jar-into-another-folder-with-maven#comment7915129_6689511

Notes: You should execute the goal at the install phase, not the package phase. The origin jar file in install phase does not contain necessary dependencies in the file content. while the jar file in the install phase contains the necessary dependencies in it which is repackaged by spring boot plugin.

install

maven command
run mvn package install instead of mvn package, to copy the final jar to expected output directory.

Dominant language
Python
Stars
5
Forks
2
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from davideuler/programming-tips

All issues in davideuler/programming-tips

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.