linux\u4fee\u6539\u73af\u5883\u53d8\u91cf \u7cfb\u7edf\u5d29\u4e86<\/strong>\uff0c\u70b9\u51fb\u641c\u7d22\u6309\u952e\uff0c\u9009\u62e9\u987b\u8981\u7684\u63d2\u4ef6\u8fdb\u884c\u5b89\u88c5<\/p>\n\u6211\u7684\u7b14\u8bb0\u672c\u91cc\u9762\u65e9\u5df2\u5b89\u88c5\u5b8c\u6210\uff0c\u56e0\u800c\u6ca1\u6709install\u6309\u952e\uff0c\u53ea\u6709update\u548cUninstall\u6309\u952e\u3002<\/p>\n
Maven2\u5e38\u7528\u547d\u4ee4\u4ecb\u7ecd<\/p>\n
\u6784\u5efa\u9879\u76ee<\/p>\n
\u6784\u5efa\u9879\u76ee\u7684\u547d\u4ee4\u4e3a<\/p>\n
mvnarchetype:generate-DarchetypeArtifactId=[\u9879\u76ee\u7c7b\u578b]-DgroupId=[\u7ec4\u8fa8\u8bc6]<\/p>\n
-DartifactId=[\u9879\u76ee\u540d\u79f0]-Dversion=[\u7248\u672c]-Dpackage=[\u5305]<\/p>\n
groupId\u7528\u4e8e\u9879\u76ee\u7684\u5206\u7ec4<\/p>\n
artifactId\u9879\u76ee\u7684\u540d\u79f0\uff0c\u4e5f\u5c31\u662f\u5305\u540d\u79f0<\/p>\n
version\u7248\u672c<\/p>\n
package\u4e3b\u8981\u8bbe\u5b9a\u76ee\u5f55\u7684\u5c42\u6b21<\/p>\n
\u9879\u76ee\u7c7b\u578b(archetypeArtifactId)\u53ef\u4ee5\u662f\u4e0b\u8ff0\u9009\u9879<\/p>\n
1.maven-archetype-j2ee-simple(J2EE\u9879\u76ee)<\/p>\n
2.maven-archetype-portlet(\u95e8\u6237)<\/p>\n
3.maven-archetype-quickstart(\u901a\u5e38Javaproject)<\/p>\n
4.maven-archetype-site(\u590d\u6742\u7ad9\u70b9)<\/p>\n
5.maven-archetype-site-simple(\u7b80\u5355\u7ad9\u70b9)<\/p>\n
6.maven-archetype-webapp(JavaWeb\u7ad9\u70b9)<\/p>\n
\u901a\u5e38\u5e38\u89c1\u7684\u662f1,3,6\u7c7b\u578b<\/p>\n
\u5728eclipse\u65b0\u5efamaven\u9879\u76ee\u4f1a\u6709\u76f8\u5173\u7684\u9009\u9879\uff0c\u5982\u53f3\u56fe\uff1a<\/p>\n
<\/p>\n
\u6784\u5efa\u5b8c\u6210\u4e00\u4e2a\u9879\u76ee\u540e\uff1a\u5e38\u89c1\u7684\u76ee\u5f55\u5982\u4e0b\uff1a<\/p>\n
<\/p>\n
\u7f16\u8bd1\u9879\u76ee\u7684\u547d\u4ee4\u4e3a<\/p>\n
mvncompile<\/p>\n
<\/p>\n
mvntest\uff1a\u8fdb\u884c\u9879\u76ee\u6d4b\u8bd5<\/p>\n
\u5728\u6267\u884c\u5355\u5143\u6d4b\u8bd5\u524d\uff0c\u9996\u5148\u4f1a\u6267\u884c\u7f16\u8bd1\u52a8\u4f5c<\/p>\n
\u6d4b\u8bd5\u62a5\u544a\u7f6e\u4e8etargetsitesurefire-reports\u4e0b<\/p>\n
mvnpackage\uff1a\u4f7f\u7528maven\u751f\u6210\u53ef\u53d1\u5e03\u7684jar\u5305\u6216\u5219war\u5305<\/p>\n
\u751f\u6210\u7684\u5305\u6587\u4ef6\u5728target\u76ee\u5f55\u4e0b<\/p>\n
mvnpackageassembly:assembly,\u6b64\u65f6\u4f1a\u5c06\u4f9d\u8d56\u76f8\u5173\u7684\u5305\u4e5f\u90fd\u6253\u5305\u8fdb\u6765<\/p>\n
<\/p>\n
\u6ce8\u610f\uff1a<\/p>\n
\u6b64\u65f6\u53ea\u662f\u5c06\u4f9d\u8d56\u7684scope\u8bbe\u7f6e\u4e3acompile\uff08compile\uff09\u7684\u548c\u8bbe\u7f6e\u4e3aprovided\u4e14\u670d\u52a1\u5668\u91cc\u9762\u6ca1\u6709\u7684jar\u5305\u4e00\u8d77\u6253\u5305\u8fdb\u6765\u3002<\/p>\n
\u5982\u53f3\u56fe\uff1a<\/p>\n
<\/p>\n
Mvnclean\u547d\u4ee4\uff1a<\/p>\n
\u6b64\u547d\u4ee4\u4f1a\u5c06target\u6587\u4ef6\u5939\u4e0b\u8fb9\u7684\u6240\u6709\u751f\u6210\u7684jar\u5305\uff0cclasses\u7b49\u90fd\u6d88\u9664<\/p>\n
<\/p>\n
\u4e4b\u540e\u91cd\u65b0\u6267\u884cmvncompile\u547d\u4ee4\u5373\u53ef\u6062\u590d\u6b63\u5e38<\/p>\n
mvnjavadoc:javadoc<\/p>\n
\u751f\u6210\u6587\u6863\u7684\u547d\u4ee4<\/p>\n
\u751f\u6210\u7684\u6587\u6863\u4f1a\u5728targetsiteapidocs\u4e0b<\/p>\n
mvnsite:site<\/p>\n
\u751f\u6210\u9879\u76ee\u7ad9\u70b9\u7684\u547d\u4ee4<\/p>\n
\u751f\u6210\u7ad9\u70b9\u7f6e\u4e8etargetsite\u4e0b<\/p>\n
mvninstall<\/p>\n
\u5c06\u9879\u76ee\u5b89\u88c5\u5230\u672c\u5730\u5e93\u623f<\/p>\n
mvndeploy<\/p>\n
\u53d1\u5e03\u9879\u76ee\u7684\u547d\u4ee4<\/p>\n
Pom.xml\u6587\u4ef6<\/p>\n
\u8bbe\u7f6e\u4f9d\u8d56<\/p>\n
\u8bbe\u7f6e\u76f8\u5173\u7684jar\u5305\u4f9d\u8d56<\/p>\n
<\/p>\n
\u53c2\u6570\u8c03\u6574<\/p>\n
Pom.xml\u6587\u4ef6\u65f6maven\u7684\u6838\u5fc3\u6587\u4ef6\uff0c\u901a\u8fc7\u6b64\u6587\u4ef6\u5bf9maven\u5de5\u7a0b\u8fdb\u884c\u914d\u7f6e\u7ba1\u7406<\/p>\n
\u8c03\u6574\u7f16\u8bd1\u53c2\u6570\uff0c\u4e3b\u8981\u901a\u8fc7\u4f7f\u7528\u8bbe\u5b9amaven-compile-plugin\u6765\u5b9e\u73b0<\/p>\n
<\/p>\n
\u53ef\u4ee5\u8bbe\u5b9a\u7f16\u8bd1\u4f7f\u7528UTF-8\u7f16\u7801\uff0c\u6e90\u7801\u4e3aJDK1.6\u7684\u7248\u672c\uff0c\u76ee\u6807\u4e5f\u4e3aJDK1.6\u7684\u7248\u672c<\/p>\n
\u8bbe\u5b9aUTF-8\u7f16\u7801<\/p>\n
\u4e0d\u4ec5\u7f16\u8bd1\u5916\uff0c\u8fd8\u6709\u8d44\u6e90\u6587\u4ef6\u3001javadoc\u7b49\u90fd\u987b\u8981\u544a\u8bc9maven\u4f7f\u7528UTF-8\u7f16\u7801linux\u547d\u4ee4\u884c\uff0c\u6211\u4eec\u53ef\u4ee5\u8bbe\u5b9a\u5982\u4e0b\u4e24\u4e2a<\/p>\n
\u63d2\u4ef6<\/p>\n
<\/p>\n
maven\u66f4\u6539pom\u6587\u4ef6\u7acb\u523b\u751f\u6548<\/p>\n
\u66f4\u6539maven\u7684pom\u6587\u4ef6\u4f9d\u8d56<\/p>\n
Maven\u66f4\u6539pom.xml\u6587\u4ef6\u540e\u7acb\u523b\u751f\u6548\u7684\u529e\u6cd5\uff1a<\/p>\n
\u4f7f\u7528mvncleaneclipse:eclipse\u547d\u4ee4\u3002\u5018\u82e5\u4e0d\u884c\uff0c\u5c31fresh\u4e00\u4e0b\u5de5\u7a0b\u6216\u5219\u5728eclipse\u4e0a\u9762\u5728clean\u4e00\u4e0b\u5de5\u7a0b\u3002<\/p>\n
\u4f7fmaven\u5728\u4e0b\u8f7d\u4f9d\u8d56\u5305\u7684\u540c\u65f6\u4e0b\u8f7d\u5176\u6e90\u4ee3\u7801\u5305\u7684\u65b9\u5f0f\uff1a<\/p>\n
1.\u4f7f\u7528maven\u547d\u4ee4\uff1amvndependency:sources\u4e0b\u8f7d\u4f9d\u8d56\u5305\u7684\u6e90\u4ee3\u7801\u3002<\/p>\n
2.\u4f7f\u7528\u53c2\u6570\uff1a-DdownloadSources=true\u4e0b\u8f7d\u6e90\u4ee3\u7801jar\u3002-DdownloadJavadocs=true\u4e0b\u8f7djavadoc\u5305\u3002<\/p>\n
\u5728eclipse\u4e2d\u7684maven\u5de5\u7a0b\u4e2d\u5f02\u5e38ClassNotFound\u7684\u89e3\u51b3\u529e\u6cd5<\/p>\n
\u5047\u5982maven\u5f15\u7528\u4e86jar\u5305\uff0c\u4f46\u662f\u5728\u5de5\u7a0b\u4e2d\u4e5f\u624d\u80fd\u627e\u5230maven\u4f9d\u8d56\uff0c\u5e76\u4e14\u8fd0\u884c\u7a0b\u5e8f\u7684\u65f6\u4faf\u62a5\u5f02\u5e38classnotfindException\uff0c\u5982\u53f3\u56fe<\/p>\n
<\/p>\n
\u4e00\u79cd\u5e38\u89c1\u7684\u89e3\u51b3\u529e\u6cd5\u5982\u4e0b\uff1a<\/p>\n
\u70b9\u51fb\u6ed1\u9f20\u53f3\u952e\u7684properties\uff0c\u4e4b\u540e\u70b9\u51fbDeploymentAssembly\uff0c\u770b\u8fd9\u513f\u9762\u6709\u6ca1\u6709MavenDependcies\u4f9d\u8d56\uff0c\u5047\u5982\u6ca1\u6709\u7684\u8bdd\uff0c\u70b9\u51fbadd\u6309\u952e<\/p>\n
\u4e4b\u540e\u9009\u4e2dJavaBuildpathEntries\uff0c\u8bb2MavenDependencies\u6dfb\u52a0\u5230\u5e03\u7f72\u914d\u7f6e\u4e2d\uff0c\u5c31\u4e0d\u4f1a\u51fa\u73b0classnotfindException\u5f02\u5e38\u4e86<\/p>\n
<\/p>\n
maven\u7f16\u8bd1\u65f6\u8df3\u8fc7test\uff1a<\/p>\n
\u65b9\u5f0f1\uff1a\u5728pom\u6587\u4ef6\u4e2d\u914d\u7f6e\uff1a<\/p>\n
org.apache.maven.pluginsmaven-surefire-plugin2.4.2true<\/p>\n
\u65b9\u5f0f2\uff1a\u76f4\u63a5\u4f7f\u7528\u547d\u4ee4\uff1a<\/p>\n
mvninstall-Dmaven.test.skip=true<\/p>\n","protected":false},"excerpt":{"rendered":"
\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u5728\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u5982\u679c\u51fa\u73b0mvn\u548cjdk\u7684\u7248\u672c\u4fe1\u606f\uff0c\u5219\u8bf4\u660emaven\u5b89\u88c5\u6210\u529f\uff1a\u4fee\u6539\u672c\u5730\u7684maven\u5e93\uff0c\u4fee\u6539conf\u6587\u4ef6\u5939\u4e0b\u9762\u7684settings.\u6211\u7684\u7535\u8111\u4e0a\u9762\u5df2\u7ecf\u5b89\u88c5\u5b8c\u6210\uff0c\u56e0\u6b64\u6ca1\u6709install\u6309\u94ae\uff0c\u53ea\u6709update\u548cUninstall\u6309\u94ae\u3002xml\u6587\u4ef6\u65f6maven\u7684\u6838\u5fc3\u6587\u4ef6\uff0c\u901a\u8fc7\u6b64\u6587\u4ef6\u5bf9maven\u5de5\u7a0b\u8fdb\u884c\u914d\u7f6e\u7ba1\u7406\u4f7fmaven\u5728\u4e0b\u8f7d\u4f9d\u8d56\u5305\u7684\u540c\u65f6\u4e0b\u8f7d\u5176\u6e90\u4ee3\u7801\u5305\u7684\u65b9\u6cd5\uff1a<\/p>\n","protected":false},"author":1,"featured_media":274101,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-274100","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/274100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=274100"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/274100\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/274101"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=274100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=274100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=274100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}