
{"id":2527,"date":"2020-11-28T10:05:58","date_gmt":"2020-11-28T02:05:58","guid":{"rendered":"http:\/\/127.0.0.2\/?p=2527"},"modified":"2020-11-28T10:05:58","modified_gmt":"2020-11-28T02:05:58","slug":"2020javaweb%e6%a1%86%e6%9e%b6%e4%b9%8bmaven%e6%a6%82%e8%bf%b0%e5%92%8c%e4%bb%93%e5%ba%93%e4%ba%86%e8%a7%a3%e4%bb%a5%e5%8f%8a%e9%aa%a8%e6%9e%b6%e5%ae%9a%e5%88%b6","status":"publish","type":"post","link":"https:\/\/www.9713job.com\/?p=2527","title":{"rendered":"2020javaweb\u6846\u67b6\u4e4bmaven\u6982\u8ff0\u548c\u4ed3\u5e93\u4e86\u89e3\u4ee5\u53ca\u9aa8\u67b6\u5b9a\u5236"},"content":{"rendered":"<h3>2020javaweb\u6846\u67b6\u4e4bmaven\u6982\u8ff0\u548c\u4ed3\u5e93\u4e86\u89e3\u4ee5\u53ca\u9aa8\u67b6\u5b9a\u5236<\/h3>\n<p><span style=\"color: #ff0000;\"><strong>\u4ec0\u4e48\u662fmaven\uff1f<\/strong><\/span><\/p>\n<p>Maven\u662f\u2f00\u4e2a\u57fa\u4e8e\u9879\u2f6c\u5bf9\u8c61\u6a21\u578b\uff08POM\uff09\u7684\u6982\u5ff5\u7684\u7eafjava\u5f00\u53d1\u7684\u5f00\u6e90\u7684\u9879\u2f6c\u7ba1\u7406\u2f2f\u5177\u3002<\/p>\n<p><strong><span style=\"color: #ff0000;\">maven\u4e0b\u8f7d<\/span><\/strong><\/p>\n<p><a href=\"http:\/\/maven.apache.org\/download.cgi\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/maven.apache.org\/download.cgi<\/a><\/p>\n<p><span style=\"color: #ff0000;\"><strong>maven\u5b89\u88c5\uff1a<\/strong><\/span><\/p>\n<p>\u89e3\u538b\u540e\u653e\u5728\u7eaf\u82f1\u6587\u76ee\u5f55\u4e0b<\/p>\n<p><span style=\"color: #ff0000;\"><strong>maven\u76ee\u5f55\u7ed3\u6784<\/strong><\/span><\/p>\n<p>bin\uff1a\u542b\u6709mvn\u8fd0\u884c\u7684\u811a\u672c<br \/>\nboot:\u542b\u6709plexus-classworlds\u7c7b\u52a0\u8f7d\u5668\u6846\u67b6,Maven \u4f7f\u2f64\u8be5\u6846\u67b6\u52a0\u8f7d\u2f83\u2f30\u7684\u7c7b\u5e93<br \/>\nconf:\u542b\u6709settings.xml\u914d\u7f6e\u2f42\u4ef6<br \/>\nlib:\u542b\u6709Maven\u8fd0\u2f8f\u65f6\u6240\u9700\u8981\u7684java\u7c7b\u5e93<br \/>\n<!--more--><\/p>\n<p><span style=\"color: #ff0000;\"><strong>maven\u73af\u5883\u53d8\u91cf<\/strong><\/span><\/p>\n<p>maven\u4f9d\u8d56java\u53d8\u91cf\uff0c\u5148\u786e\u4fdd\u5df2\u914d\u7f6ejava\u73af\u5883\u53d8\u91cf\uff0cjdk7+\u3002<\/p>\n<p>MAVEN_HOME\uff1amaven\u7684\u5b89\u88c5\u76ee\u5f55<br \/>\npath\uff1amaven\u76ee\u5f55\u4e0b\u7684bin\u76ee\u5f55<\/p>\n<p><strong><span style=\"color: #ff0000;\">maven\u6d4b\u8bd5\uff1a\u67e5\u770b\u7248\u672c\u53f7<\/span><\/strong><\/p>\n<p>mvn -v<\/p>\n<p><span style=\"color: #ff0000;\"><strong>maven\u914d\u7f6e\uff1a<\/strong><\/span><\/p>\n<p>\u5728maven\u5b89\u88c5\u76ee\u5f55\u7684conf\u76ee\u5f55\u4e0bsettings.xml<\/p>\n<p><span style=\"color: #ff0000;\"><strong>maven\u6dfb\u52a0\u672c\u5730\u4ed3\u5e93<\/strong><\/span><\/p>\n<p>&lt;localRepository&gt;\u672c\u5730\u4ed3\u5e93\u76ee\u5f55\uff0c\u5982\uff1aF:\\mavenlibs&lt;\/localRepository&gt;<\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u6dfb\u52a0jdk\u7248\u672c<\/strong><\/span><\/p>\n<p>\u5728\u5df2\u6709\u7684 &lt;profiles&gt; \u6807\u7b7e\u4e0b\u9762\u6dfb\u52a0<\/p>\n<pre>&lt;profile&gt;\r\n  &lt;id&gt;myjdk&lt;\/id&gt;\r\n  &lt;activation&gt;\r\n    &lt;activeByDefault&gt;true&lt;\/activeByDefault&gt;\r\n    &lt;jdk&gt;1.8&lt;\/jdk&gt;\r\n  &lt;\/activation&gt;\r\n  &lt;properties&gt;\r\n      &lt;maven.compiler.source&gt;1.8&lt;\/maven.compiler.source&gt;\r\n      &lt;maven.compiler.target&gt;1.8&lt;\/maven.compiler.target&gt;\r\n      &lt;maven.compiler.compilerVersion&gt;1.8&lt;\/maven.compiler.compilerVersion&gt;\r\n   &lt;\/properties&gt;\r\n&lt;\/profile&gt;\r\n<\/pre>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/11\/28\/1.png\" alt=\"\" width=\"680\" \/><br \/>\n<span style=\"color: #ff0000;\"><strong>\u8ba9\u589e\u52a0\u7684profile\u751f\u6548<\/strong><\/span><\/p>\n<pre>&lt;activeProfiles&gt;\r\n  &lt;activeProfile&gt;myjdk&lt;\/activeProfile&gt;\r\n&lt;\/activeProfiles&gt;\r\n<\/pre>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/11\/28\/2.png\" alt=\"\" width=\"680\" \/><br \/>\n<span style=\"color: #ff0000;\"><strong>maven\u4ed3\u5e93<\/strong><\/span><\/p>\n<p>\u5728maven\u672f\u8bed\u4e2d\uff0c\u4ed3\u5e93\u662f\u4e00\u4e2a\u4f4d\u7f6e place\u3002<br \/>\nmaven\u4ed3\u5e93\u662f\u9879\u76ee\u4e2d\u4f9d\u8d56\u7684\u7b2c\u4e09\u65b9\u5e93\uff0c\u8fd9\u4e2a\u5e93\u6240\u5728\u7684\u4f4d\u7f6e\u53eb\u505a\u4ed3\u5e93\u3002<br \/>\n\u5728 Maven \u4e2d\uff0c\u4efb\u4f55\u2f00\u4e2a\u4f9d\u8d56\u3001\u63d2\u4ef6\u6216\u8005\u9879\u2f6c\u6784\u5efa\u7684\u8f93\u51fa\uff0c\u90fd\u53ef\u4ee5\u79f0\u4e4b\u4e3a\u6784\u4ef6\u3002<br \/>\nMaven \u4ed3\u5e93\u80fd\u5e2e\u52a9\u6211\u4eec\u5b58\u50a8\u3001\u7ba1\u7406\u6784\u4ef6\u7684\u5730\u2f45\u3002<br \/>\n\u64cd\u4f5c\u6a21\u5f0f\uff1a\u5f00\u53d1\u2f08\u5458\u5b9a\u4e49\u7b80\u5355\u7684\u914d\u7f6e\uff0c\u63cf\u8ff0\u9700\u8981\u54ea\u4e9b\u4f9d\u8d56\uff0cmaven\u2f83\u52a8\u4ece\u4ed3\u5e93\u4e2d\u4e0b\u8f7d\u4f9d\u8d56(jar)<\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u4ed3\u5e93\u5206\u7c7b\uff1a<\/strong><\/span><\/p>\n<p>maven\u4ed3\u5e93<br \/>\n|&#8212;\u672c\u5730\u4ed3\u5e93<br \/>\n|&#8212;\u8fdc\u7a0b\u4ed3\u5e93<\/p>\n<pre>    |-------\u4e2d\u592e\u4ed3\u5e93<\/pre>\n<pre>    |-------\u516c\u5171\u5e93<\/pre>\n<pre>    |-------\u79c1\u670d<\/pre>\n<p><span style=\"color: #ff0000;\">maven\u9879\u76ee\u4f18\u5148\u8c03\u7528\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u5982\u679c\u8fdc\u7a0b\u4ed3\u5e93\u6ca1\u6709\u5c31\u53bb\u4e2d\u592e\u4ed3\u5e93\u67e5\u627e<\/span><\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u672c\u5730\u4ed3\u5e93<\/strong><\/span><\/p>\n<p>1.\u5728\u5b89\u88c5 Maven \u540e\u5e76\u4e0d\u4f1a\u521b\u5efa\uff0c\u7b2c\u2f00\u6b21\u6267\u2f8f maven \u547d\u4ee4\u65f6\u624d\u521b\u5efa\u3002<br \/>\n2.Maven \u6240\u9700\u8981\u7684\u6784\u4ef6\u90fd\u662f\u76f4\u63a5\u4ece\u672c\u5730\u4ed3\u5e93\u83b7\u53d6\u7684\u3002<br \/>\n\u5982\u679c\u672c\u5730\u4ed3\u5e93\u6ca1\u6709\uff0c\u5b83\u4f1a\u2fb8\u5148\u5c1d\u8bd5\u4ece\u8fdc\u7a0b\u4ed3\u5e93\u4e0b\u8f7d\u6784\u4ef6\u2f84\u672c\u5730\u4ed3\u5e93\uff0c\u7136\u540e\u518d\u4f7f\u2f64\u672c\u5730\u4ed3\u5e93\u7684\u6784\u4ef6\u3002<br \/>\n3.\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4e0d\u7ba1Linux\u8fd8\u662f Windows\uff0c\u6bcf\u4e2a\u2f64\u6237\u5728\u2f83\u2f30\u7684\u2f64\u6237\u2f6c\u5f55\u4e0b\u90fd\u6709\u2f00\u4e2a\u8def\u5f84\u540d\u4e3a<br \/>\n.m2\/respository\/ \u7684\u672c\u5730\u4ed3\u5e93\u2f6c\u5f55\u3002\u53ef\u4ee5\u5728setttings.xml\u4e2d\u4fee\u6539<\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u4e2d\u592e\u4ed3\u5e93<\/strong><\/span><\/p>\n<p>Maven \u4e2d\u592e\u4ed3\u5e93\u662f\u7531 Maven \u793e\u533a\u63d0\u4f9b\u7684\u4ed3\u5e93\uff0c<br \/>\n\u5176\u4e2d\u5305\u542b\u4e86\u7edd\u2f24\u591a\u6570\u6d41\u2f8f\u7684\u5f00\u6e90Java\u6784\u4ef6\u3002\u662f\u9ed8\u8ba4\u7684\u8fdc\u7a0b\u4ed3\u5e93\u3002<br \/>\n<a href=\"https:\/\/mvnrepository.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/mvnrepository.com\/<\/a> \u53ef\u4ee5\u641c\u7d22\u9700\u8981\u7684\u4f9d\u8d56\u7684\u76f8\u5173\u4fe1\u606f\uff08\u4ed3\u5e93\u641c\u7d22\u670d\u52a1\uff09<br \/>\n<a href=\"http:\/\/repo.maven.apache.org\/maven2\/\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/repo.maven.apache.org\/maven2\/<\/a> \u4e2d\u592e\u4ed3\u5e93\u5730\u5740<\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u8fdc\u7a0b\u4ed3\u5e93<\/strong><\/span><\/p>\n<p>\u5982\u679c Maven \u5728\u4e2d\u592e\u4ed3\u5e93\u4e2d\u4e5f\u627e\u4e0d\u5230\u4f9d\u8d56\u7684\u2f42\u4ef6\uff0c\u5b83\u4f1a\u505c\u2f4c\u6784\u5efa\u8fc7\u7a0b\u5e76\u8f93\u51fa\u9519\u8bef\u4fe1\u606f\u5230\u63a7\u5236\u53f0\u3002<br \/>\n\u4e3a\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\uff0cMaven \u63d0\u4f9b\u4e86\u8fdc\u7a0b\u4ed3\u5e93\u7684\u6982\u5ff5\uff0c\u5b83\u662f\u5f00\u53d1\u2f08\u5458\u2f83\u2f30\u5b9a\u5236\u4ed3\u5e93\u3002<br \/>\n\u2f50\u5982aliyun\u4ed3\u5e93\uff08<a href=\"http:\/\/maven.aliyun.com\/nexus\/content\/groups\/public\/\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/maven.aliyun.com\/nexus\/content\/groups\/public\/<\/a>\uff09<\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u9aa8\u67b6\u5b9a\u5236<\/strong><\/span><\/p>\n<p>\u6784\u5efawebapp\u9879\u76ee\u9aa8\u67b6\uff1a<\/p>\n<p>\u5728\u672c\u5730\u4ed3\u5e93&#8211;&gt;org&#8211;&gt;apache&#8211;&gt;maven&#8211;&gt;archetypes&#8211;&gt;maven-archetype-webapp&#8211;&gt;1.4<\/p>\n<p>\u627e\u5230maven-archetype-webapp-1.4.jar\uff0c\u7528\u89e3\u538b\u8f6f\u4ef6\u6253\u5f00\uff0c\u627e\u5230pom.xml\u6587\u4ef6<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/11\/28\/3.png\" alt=\"\" width=\"680\" \/><\/p>\n<p>\u53f3\u952e\uff0c\u5185\u90e8\u67e5\u770b\u5668\u6253\u5f00<\/p>\n<p>\u5c061.7\u6539\u62101.8<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/11\/28\/4.png\" alt=\"\" width=\"680\" \/><\/p>\n<p>\u7136\u540e\u4fdd\u5b58\u5173\u95ed<\/p>\n<p>\u627e\u5230WEB-INF\u4e0b\u7684web.xml\u914d\u7f6e\u6587\u4ef6<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/11\/28\/5.png\" alt=\"\" width=\"680\" \/><\/p>\n<p>\u53f3\u952e\uff0c\u5185\u90e8\u67e5\u770b\u5668\u6253\u5f00\uff0c\u627e\u5230Tomcat\u5b89\u88c5\u76ee\u5f55\uff0c\u627e\u5230\\webapps\\examples\\WEB-INF\u4e0b\u7684web.xml<\/p>\n<p>\u590d\u5236\u8fd9\u6bb5\u4ee3\u7801<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/11\/28\/6.png\" alt=\"\" width=\"680\" \/><\/p>\n<p>\u5c06\u8fd9\u6bb5\u4ee3\u7801\u66ff\u6362\uff0c\u8fd9\u6837\u53ef\u4ee5\u4f7f\u7528EL\u8868\u8fbe\u5f0f\u4ee5\u53caJSTL<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/11\/28\/7.png\" alt=\"\" width=\"680\" \/><\/p>\n<p>\u6700\u7ec8\u6548\u679c\u56fe\uff0c\u7136\u540e\u4fdd\u5b58\uff0c\u65b0\u5efa\u9aa8\u67b6\uff0c\u81ea\u52a8\u52a0\u8f7d\u4e86\u3002<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2254\" src=\"\/wp-content\/uploads\/2020\/11\/28\/8.png\" alt=\"\" width=\"680\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>2020javaweb\u6846\u67b6\u4e4bmaven\u6982\u8ff0\u548c\u4ed3\u5e93\u4e86\u89e3\u4ee5\u53ca\u9aa8\u67b6\u5b9a\u5236 \u4ec0\u4e48\u662fmaven\uff1f Maven\u662f\u2f00\u4e2a\u57fa\u4e8e\u9879\u2f6c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-2527","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/2527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2527"}],"version-history":[{"count":7,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/2527\/revisions"}],"predecessor-version":[{"id":2535,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/2527\/revisions\/2535"}],"wp:attachment":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}