Copy spring boot packaged fatjar to another directory
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from davideuler/programming-tips
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
-
Difficulty 1/5 Under an hour Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
build milvus on MacOpen
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in davideuler/programming-tips
Similar issues
-
bug frontend
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
PedestrianDynamics/pyFDS-Evac#552 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
resend/resend-skills#144 ·
Maintainers usually reply within 1 day
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
GNS3/gns3-server#2935 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
TauricResearch/TradingAgents#1476 ·
Maintainers usually reply within 2 days