Maven’s method of packaging web projects into war and jar files at the same time

This paper introduces how Maven packages web projects into war and jar files at the same time, and shares it with you. The details are as follows:

First, in POM Specify the packaging method of war in the XML file, war

When the above code executes Maven install in eclipse, it will be marked as war by default and put into the local warehouse.

Web projects are packaged as war and jar files at the same time

1. First add in POM Add a plug-in Maven jar plugin to the XML to generate a jar package when calling the command MVN package install or MVN package deploy. Or use MVN package to generate jar packages. The rack package generated by the plug-in will be placed in the target folder of the project.

2. Then configure the Maven install plugin plug-in so that when Maven install is executed in eclipse, jars and wars are generated to the local repository at the same time.

3. Reconfigure org apache. maven. Plugins plug-in, so that when deploying in eclipse, jars and war are generated to the remote warehouse at the same time.

The source code is as follows:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>