In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how Springboot integrates the maven socket to call maven release plugin to achieve one-click packaging function. I hope you will get something after reading this article. Let's discuss it together.
Maven release plugin configuration integrates maven-invoker to enable the program to execute the mvn command 1. Guide package org.apache.maven.shared maven-invoker 3.1.0
Note the maven-invoker version. A lower version may result in incompatibility.
two。 The test program public class MavenTest {/ / Direct execution mvn release:prepare-X is interactive and cannot enter version parameters while the program is in progress. / / while executing mvn-B release:prepare-X can be executed directly through the program. However, to customize the version information, you need to configure the parameters of pom release plugin, or use the following command / / actually executed mvn command. / / mvn-B release:prepare-X-Dtag=VersionControlDemo- "0.4.0"-DreleaseVersion= "0.4.0"-DdevelopmentVersion= "0.4.1-SNAPSHOT" / / mvn release:perform-X public static void main (String [] args) throws MavenInvocationException {InvocationRequest request = new DefaultInvocationRequest (); / / obtain pom file address String relativelyPath=System.getProperty ("user.dir"); String pomPath = relativelyPath+ "/ pom.xml" System.out.println (pomPath); request.setPomFile (new File (pomPath)); Invoker invoker = new DefaultInvoker (); / / get the maven environment variable address String m2Path = System.getenv ("MAVEN_HOME"); System.out.println ("m2Path:" + m2Path); invoker.setMavenHome (new File (m2Path)) Try {/ / tag information of this version String tag = "VersiongControlDemo-0.4.0"; / / the version number of this release is String version = "0.4.0"; / / the snapshot version number of the next version is String developmentVersion= "0.4.1-SNAPSHOT"; List goals = new ArrayList () Goals.add ("- B"); goals.add ("release:prepare"); goals.add ("- X"); goals.add ("- Dtag=" + tag); goals.add ("- DreleaseVersion=" + version); goals.add ("- DdevelopmentVersion=" + developmentVersion); request.setGoals (goals) System.out.println ("start:" + request.getGoals ()); invoker.execute (request); request.setGoals (Collections.singletonList ("release:perform-X")); System.out.println ("start:" + request.getGoals ()); invoker.execute (request);} catch (MavenInvocationException e) {e.printStackTrace () Return;}
Run the test demo. It turned out to be a success. Pay attention to the version parameters before each run, and do not conflict. )
Similarly, release:rollback and other related rollback commands can be configured.
After reading this article, I believe you have a certain understanding of "how Springboot integrates maven sockets to call maven release plugin to achieve one-click packaging function". If you want to know more about it, welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.