Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of BAT script calling maven Command

Shulou Source: shulou.com Published: 2022-06-03 19:32:32 11月12日 Update

This article will explain in detail about BAT script call maven command example analysis, Xiaobian think quite practical, so share for everyone to make a reference, I hope you can have some harvest after reading this article.

Recently encountered a problem, because there are a lot of local libraries need to be installed, the dependency method used before is system, because it cannot be automatically introduced at the time of package.

org.zhixun IKAnalyzer 1.0 system ${basedir}/../ parent/libs/IKAnalyzer3.2.3Stable.jar

Therefore, you need to create a batch script that automatically installs:

mvn install:install-file -DgroupId=org.zhixun -DartifactId=IKAnalyzer -Dversion=3.2.3 -Dpackaging=jar -Dfile=libs/IKAnalyzer3.2.3Stable.jar

However, it always exits automatically after executing an mvn target. The pause command is also invalid. The analysis reason is that mvn itself is a bat command. Therefore, when exiting, the entire script process will exit. Add the call command to call it.

@echo off set localdir=%~dp0 call mvn install:install-file -DgroupId=org.zhixun -DartifactId=IKAnalyzer -Dversion=3.2.3 -Dpackaging=jar -Dfile=%localdir%/libs/IKAnalyzer3.2.3Stable.jar pause This article is shared here. I hope the above content can help you to learn more. If you think the article is good, please share it for more people to see.

Tags: Commands scripts analysis time articles examples more good practical content reasons piles articles methods goals knowledge processes problems references help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MySQL Linux Microsoft MariaDB