{"id":5837,"date":"2024-08-01T22:46:29","date_gmt":"2024-08-01T14:46:29","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=5837"},"modified":"2024-08-01T22:46:29","modified_gmt":"2024-08-01T14:46:29","slug":"spring-boot%e9%a1%b9%e7%9b%aepom-xml%e4%b8%ad%e7%9a%84project-basedir%e5%8f%98%e9%87%8f%e7%94%a8%e6%b3%95%e6%95%b4%e7%90%86","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring-boot\/spring-boot%e9%a1%b9%e7%9b%aepom-xml%e4%b8%ad%e7%9a%84project-basedir%e5%8f%98%e9%87%8f%e7%94%a8%e6%b3%95%e6%95%b4%e7%90%86\/","title":{"rendered":"Spring Boot\u9879\u76eepom.xml\u4e2d\u7684${project.basedir}\u53d8\u91cf\u7528\u6cd5\u6574\u7406"},"content":{"rendered":"<div class='wxsyncmain'>\n<p data-line=\"0\"><span style=\"text-align: left;letter-spacing: 0.034em;font-size: 16px;\">\u5728\u4f7f\u7528 Spring Boot \u505a\u9879\u76ee\u7684\u65f6\u5019\uff0c\u7ecf\u5e38\u4f1a\u4f7f\u7528\u4e00\u4e9b\u7b2c\u4e09\u65b9jar\u5305\uff0c\u6709\u4e9bjar\u5305\u5728Maven\u4ed3\u5e93<\/span>https:\/\/mvnrepository.com\/<span style=\"text-align: left;letter-spacing: 0.034em;font-size: 16px;\">\u4e2d\u6ca1\u6709\u5907\u6848\uff0c\u65e0\u6cd5\u5728pom\u4e2d\u76f4\u63a5\u5f15\u5165\u3002<\/span><\/p>\n<section style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u8fd9\u4e2a\u65f6\u5019\uff0c\u6211\u4eec\u5c31\u9700\u8981\u628ajar\u5305\u5bfc\u5165\u5230\u9879\u76ee\u4e2d\uff0c\u653e\u5728\u67d0\u4e2a\u6587\u4ef6\u5939\u4e0b\uff0c\u6bd4\u5982lib\u6587\u4ef6\u4e0b\uff0c\u7136\u540e\u518d\u5728pom\u4e2d\u5f15\u5165\u3002\u5728pom\u4e2d\u5f15\u5165\u7684\u65f6\u5019\uff0c\u9700\u8981\u589e\u52a0\u4e00\u4e2a\u5c5e\u6027\u7cfb\u7edf\u8def\u5f84\uff1a&lt;systemPath&gt;${project.basedir}\/lib\/xxx.jar&lt;\/systemPath&gt;\uff0c\u6765\u6307\u660e\u67b6\u5305\u4f4d\u7f6e\u3002<\/span><\/section>\n<section style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u5728\u7cfb\u7edf\u8def\u5f84\u4e2d\u7684\u53d8\u91cf${project.basedir}\uff0c\u5b83\u662f\u4ec0\u4e48\u610f\u601d\u5462\uff1f<\/span><\/section>\n<h3 data-line=\"6\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"color: rgb(255, 76, 65);\"><strong><span style=\"font-size: 16px;\">\u4e00\u3001${project.basedir}\u53d8\u91cf\u4ecb\u7ecd<\/span><\/strong><\/span><\/h3>\n<section style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u5728 Spring Boot \u9879\u76ee\u7684POM\u6587\u4ef6\u4e2d\uff0c${project.basedir}\u662fMaven\u5185\u7f6e\u7684\u4e00\u4e2a\u5c5e\u6027\uff0c\u800c\u4e0d\u662f\u7528\u6237\u5b9a\u4e49\u7684\u5c5e\u6027\u3002\u5b83\u662f\u7531Maven\u81ea\u52a8\u63d0\u4f9b\u7684\uff0c\u7528\u4e8e\u6307\u5411\u5f53\u524d\u9879\u76ee\u7684\u57fa\u76ee\u5f55\u3002\u5177\u4f53\u6765\u8bf4\uff0c${project.basedir}\u6307\u5411\u7684\u662f\u5305\u542bpom.xml\u6587\u4ef6\u7684\u76ee\u5f55\u3002<\/span><\/section>\n<section style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u5047\u8bbe\u6709\u4e00\u4e2a\u9879\u76ee\u76ee\u5f55\u7ed3\u6784\u5982\u4e0b\uff1a<\/span><\/section>\n<pre style=\"font-size: 16px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;margin-bottom: 20px;overflow: auto;overflow-wrap: normal;word-break: break-all;padding: 10px;border-width: 1px;border-style: solid;border-color: rgb(217, 217, 217);border-radius: 0px;line-height: 20px;background-color: rgb(40, 44, 52);color: rgb(51, 51, 51);letter-spacing: normal;text-align: start;\"><code style=\"font-size: 12px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;display: block;overflow-x: auto;background: transparent;color: rgb(199, 37, 78);vertical-align: middle;border-width: initial;border-style: none;border-color: initial;\"><span style=\"color: rgb(198, 120, 221);\">my-project<\/span>\u251c\u2500\u2500\u2500<span style=\"color: rgb(198, 120, 221);\">pom<\/span><span style=\"color: rgb(224, 108, 117);\">.xml<\/span>\u2502\u251c\u2500\u2500\u2500<span style=\"color: rgb(198, 120, 221);\">lib<\/span>\u2502\u2514\u2500\u2500\u2500<span style=\"color: rgb(198, 120, 221);\">src<\/span>    \u2514\u2500\u2500\u2500<span style=\"color: rgb(198, 120, 221);\">main<\/span>        \u251c\u2500\u2500\u2500<span style=\"color: rgb(198, 120, 221);\">java<\/span>        \u2514\u2500\u2500\u2500<span style=\"color: rgb(198, 120, 221);\">resources<\/span><\/code><\/pre>\n<p data-line=\"22\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u5728\u8fd9\u4e2a\u7ed3\u6784\u4e2d\uff1amy-project\u662f\u9879\u76ee\u7684\u6839\u76ee\u5f55\u3002pom.xml\u662fMaven\u9879\u76ee\u7684\u6838\u5fc3\u914d\u7f6e\u6587\u4ef6\uff0c\u4f4d\u4e8e\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e0b\u3002lib\u76ee\u5f55\u7528\u4e8e\u5b58\u653e\u9879\u76ee\u7684\u5e93\u6587\u4ef6\uff0c\u4f8b\u5982\u7b2c\u4e09\u65b9jar\u5305\u7b49\u3002src\u76ee\u5f55\u662f\u6e90\u4ee3\u7801\u7684\u6839\u76ee\u5f55\u3002src\/main\/java\u76ee\u5f55\u7528\u4e8e\u5b58\u653e\u9879\u76ee\u7684java\u6e90\u4ee3\u7801\u3002src\/main\/resources\u76ee\u5f55\u7528\u4e8e\u5b58\u653e\u9879\u76ee\u7684\u8d44\u6e90\u6587\u4ef6\uff0c\u5982\u914d\u7f6e\u6587\u4ef6\u3001\u56fe\u7247\u7b49\u3002<\/span><\/p>\n<p data-line=\"30\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u8fd9\u662f\u4e00\u4e2a\u5178\u578b\u7684Spring Boot\u9879\u76ee\u7684\u76ee\u5f55\u7ed3\u6784\uff0c\u5b83\u9075\u5faaMaven\u7684\u6807\u51c6\u76ee\u5f55\u5e03\u5c40\u89c4\u8303\u3002\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\uff0c\u53ef\u80fd\u8fd8\u4f1a\u6709\u5176\u4ed6\u76ee\u5f55\uff0c\u5982src\/test\/java\u7528\u4e8e\u5b58\u653e\u6d4b\u8bd5\u4ee3\u7801\uff0csrc\/main\/webapp\u7528\u4e8e\u5b58\u653eWeb\u5e94\u7528\u8d44\u6e90\u7b49\u3002<\/span><\/p>\n<p data-line=\"32\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u5728pom.xml\u4e2d\uff0c${project.basedir}\u7684\u503c\u5c31\u662f\/my-project\u3002\u6211\u4eec\u53ef\u4ee5\u5728pom.xml\u6587\u4ef6\u4e2d\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u4f7f\u7528\u5b83\u3002<\/span><\/p>\n<h4 data-line=\"34\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"color: rgb(255, 76, 65);\"><strong><span style=\"font-size: 16px;\">\u4e8c\u3001${project.basedir}\u5e94\u7528\u793a\u4f8b<\/span><\/strong><\/span><\/h4>\n<p data-line=\"36\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;letter-spacing: 0.034em;\">1. \u914d\u7f6e\u6784\u5efa\u8f93\u51fa\u76ee\u5f55<\/span><\/p>\n<p data-line=\"40\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u53ef\u4ee5\u4f7f\u7528${project.basedir}\u6765\u6307\u5b9a\u6784\u5efa\u8f93\u51fa\u76ee\u5f55\u7684\u8def\u5f84\u3002<\/span><\/p>\n<pre style=\"font-size: 16px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;margin-bottom: 20px;overflow: auto;overflow-wrap: normal;word-break: break-all;padding: 10px;border-width: 1px;border-style: solid;border-color: rgb(217, 217, 217);border-radius: 0px;line-height: 20px;background-color: rgb(40, 44, 52);color: rgb(51, 51, 51);letter-spacing: normal;text-align: start;\"><code style=\"font-size: 12px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;display: block;overflow-x: auto;background: transparent;color: rgb(199, 37, 78);vertical-align: middle;border-width: initial;border-style: none;border-color: initial;\">&lt;<span style=\"color: rgb(224, 108, 117);\">build<\/span>&gt;    &lt;<span style=\"color: rgb(224, 108, 117);\">directory<\/span>&gt;${project.basedir}\/target&lt;\/<span style=\"color: rgb(224, 108, 117);\">directory<\/span>&gt;    &lt;<span style=\"color: rgb(224, 108, 117);\">outputDirectory<\/span>&gt;${project.basedir}\/target\/classes&lt;\/<span style=\"color: rgb(224, 108, 117);\">outputDirectory<\/span>&gt;&lt;\/<span style=\"color: rgb(224, 108, 117);\">build<\/span>&gt;<\/code><\/pre>\n<h3 data-line=\"49\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">2. \u5f15\u7528\u5916\u90e8\u8d44\u6e90<\/span><\/h3>\n<p data-line=\"51\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u5728\u4e00\u4e9b\u63d2\u4ef6\u914d\u7f6e\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528${project.basedir}\u6765\u5f15\u7528\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u7684\u8d44\u6e90\u6216\u811a\u672c\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u4f7f\u7528Maven\u7684exec-maven-plugin\u6267\u884c\u6839\u76ee\u5f55\u4e0b\u7684\u811a\u672c\uff1a<\/span><\/p>\n<pre style=\"font-size: 16px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;margin-bottom: 20px;overflow: auto;overflow-wrap: normal;word-break: break-all;padding: 10px;border-width: 1px;border-style: solid;border-color: rgb(217, 217, 217);border-radius: 0px;line-height: 20px;background-color: rgb(40, 44, 52);color: rgb(51, 51, 51);letter-spacing: normal;text-align: start;\"><code style=\"font-size: 12px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;display: block;overflow-x: auto;background: transparent;color: rgb(199, 37, 78);vertical-align: middle;border-width: initial;border-style: none;border-color: initial;\">&lt;<span style=\"color: rgb(224, 108, 117);\">build<\/span>&gt;    &lt;<span style=\"color: rgb(224, 108, 117);\">plugins<\/span>&gt;        &lt;<span style=\"color: rgb(224, 108, 117);\">plugin<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">groupId<\/span>&gt;org.codehaus.mojo&lt;\/<span style=\"color: rgb(224, 108, 117);\">groupId<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">artifactId<\/span>&gt;exec-maven-plugin&lt;\/<span style=\"color: rgb(224, 108, 117);\">artifactId<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">version<\/span>&gt;3.0.0&lt;\/<span style=\"color: rgb(224, 108, 117);\">version<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">executions<\/span>&gt;                &lt;<span style=\"color: rgb(224, 108, 117);\">execution<\/span>&gt;                    &lt;<span style=\"color: rgb(224, 108, 117);\">goals<\/span>&gt;                        &lt;<span style=\"color: rgb(224, 108, 117);\">goal<\/span>&gt;exec&lt;\/<span style=\"color: rgb(224, 108, 117);\">goal<\/span>&gt;                    &lt;\/<span style=\"color: rgb(224, 108, 117);\">goals<\/span>&gt;                &lt;\/<span style=\"color: rgb(224, 108, 117);\">execution<\/span>&gt;            &lt;\/<span style=\"color: rgb(224, 108, 117);\">executions<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">configuration<\/span>&gt;                &lt;<span style=\"color: rgb(224, 108, 117);\">executable<\/span>&gt;${project.basedir}\/scripts\/my-script.sh&lt;\/<span style=\"color: rgb(224, 108, 117);\">executable<\/span>&gt;            &lt;\/<span style=\"color: rgb(224, 108, 117);\">configuration<\/span>&gt;        &lt;\/<span style=\"color: rgb(224, 108, 117);\">plugin<\/span>&gt;    &lt;\/<span style=\"color: rgb(224, 108, 117);\">plugins<\/span>&gt;&lt;\/<span style=\"color: rgb(224, 108, 117);\">build<\/span>&gt;<\/code><\/pre>\n<p data-line=\"74\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u5f15\u7528\u672c\u5730jar\u5305\uff1a<\/span><\/p>\n<pre style=\"font-size: 16px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;margin-bottom: 20px;overflow: auto;overflow-wrap: normal;word-break: break-all;padding: 10px;border-width: 1px;border-style: solid;border-color: rgb(217, 217, 217);border-radius: 0px;line-height: 20px;background-color: rgb(40, 44, 52);color: rgb(51, 51, 51);letter-spacing: normal;text-align: start;\"><code style=\"font-size: 12px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;display: block;overflow-x: auto;background: transparent;color: rgb(199, 37, 78);vertical-align: middle;border-width: initial;border-style: none;border-color: initial;\"><span style=\"color: rgb(92, 99, 112);font-style: italic;\">&lt;!-- \u4e32\u53e3jar start --&gt;<\/span>        &lt;<span style=\"color: rgb(224, 108, 117);\">dependency<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">groupId<\/span>&gt;gnu.io&lt;\/<span style=\"color: rgb(224, 108, 117);\">groupId<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">artifactId<\/span>&gt;RXTXcomm&lt;\/<span style=\"color: rgb(224, 108, 117);\">artifactId<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">version<\/span>&gt;2.2&lt;\/<span style=\"color: rgb(224, 108, 117);\">version<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">scope<\/span>&gt;system&lt;\/<span style=\"color: rgb(224, 108, 117);\">scope<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">systemPath<\/span>&gt;${project.basedir}\/lib\/RXTXcomm.jar&lt;\/<span style=\"color: rgb(224, 108, 117);\">systemPath<\/span>&gt;        &lt;\/<span style=\"color: rgb(224, 108, 117);\">dependency<\/span>&gt;        <span style=\"color: rgb(92, 99, 112);font-style: italic;\">&lt;!-- \u4e32\u53e3jar end --&gt;<\/span><\/code><\/pre>\n<h3 data-line=\"87\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">3. \u8d44\u6e90\u8fc7\u6ee4<\/span><\/h3>\n<p data-line=\"88\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u4f7f\u7528Maven\u8d44\u6e90\u63d2\u4ef6\u65f6\uff0c\u53ef\u4ee5\u914d\u7f6e\u8d44\u6e90\u8fc7\u6ee4\u5e76\u4f7f\u7528${project.basedir}\u6765\u6307\u5b9a\u8d44\u6e90\u6587\u4ef6\u7684\u4f4d\u7f6e\u3002<\/span><\/p>\n<pre style=\"font-size: 16px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;margin-bottom: 20px;overflow: auto;overflow-wrap: normal;word-break: break-all;padding: 10px;border-width: 1px;border-style: solid;border-color: rgb(217, 217, 217);border-radius: 0px;line-height: 20px;background-color: rgb(40, 44, 52);color: rgb(51, 51, 51);letter-spacing: normal;text-align: start;\"><code style=\"font-size: 12px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;display: block;overflow-x: auto;background: transparent;color: rgb(199, 37, 78);vertical-align: middle;border-width: initial;border-style: none;border-color: initial;\">&lt;<span style=\"color: rgb(224, 108, 117);\">build<\/span>&gt;    &lt;<span style=\"color: rgb(224, 108, 117);\">resources<\/span>&gt;        &lt;<span style=\"color: rgb(224, 108, 117);\">resource<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">directory<\/span>&gt;${project.basedir}\/src\/main\/resources&lt;\/<span style=\"color: rgb(224, 108, 117);\">directory<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">filtering<\/span>&gt;true&lt;\/<span style=\"color: rgb(224, 108, 117);\">filtering<\/span>&gt;        &lt;\/<span style=\"color: rgb(224, 108, 117);\">resource<\/span>&gt;    &lt;\/<span style=\"color: rgb(224, 108, 117);\">resources<\/span>&gt;&lt;\/<span style=\"color: rgb(224, 108, 117);\">build<\/span>&gt;<\/code><\/pre>\n<h3 data-line=\"101\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">4. \u914d\u7f6e\u6d4b\u8bd5\u8d44\u6e90\u76ee\u5f55<\/span><\/h3>\n<p data-line=\"102\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u7c7b\u4f3c\u5730\uff0c\u53ef\u4ee5\u914d\u7f6e\u6d4b\u8bd5\u8d44\u6e90\u7684\u76ee\u5f55\u8def\u5f84\u3002<\/span><\/p>\n<pre style=\"font-size: 16px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;margin-bottom: 20px;overflow: auto;overflow-wrap: normal;word-break: break-all;padding: 10px;border-width: 1px;border-style: solid;border-color: rgb(217, 217, 217);border-radius: 0px;line-height: 20px;background-color: rgb(40, 44, 52);color: rgb(51, 51, 51);letter-spacing: normal;text-align: start;\"><code style=\"font-size: 12px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;display: block;overflow-x: auto;background: transparent;color: rgb(199, 37, 78);vertical-align: middle;border-width: initial;border-style: none;border-color: initial;\">&lt;<span style=\"color: rgb(224, 108, 117);\">build<\/span>&gt;    &lt;<span style=\"color: rgb(224, 108, 117);\">testResources<\/span>&gt;        &lt;<span style=\"color: rgb(224, 108, 117);\">testResource<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">directory<\/span>&gt;${project.basedir}\/src\/test\/resources&lt;\/<span style=\"color: rgb(224, 108, 117);\">directory<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">filtering<\/span>&gt;false&lt;\/<span style=\"color: rgb(224, 108, 117);\">filtering<\/span>&gt;        &lt;\/<span style=\"color: rgb(224, 108, 117);\">testResource<\/span>&gt;    &lt;\/<span style=\"color: rgb(224, 108, 117);\">testResources<\/span>&gt;&lt;\/<span style=\"color: rgb(224, 108, 117);\">build<\/span>&gt;<\/code><\/pre>\n<h3 data-line=\"114\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">5. \u4f5c\u4e3a\u7cfb\u7edf\u5c5e\u6027<\/span><\/h3>\n<p data-line=\"115\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u5728\u4e00\u4e9b\u63d2\u4ef6\u4e2d\uff0c\u53ef\u4ee5\u5c06${project.basedir}\u4f5c\u4e3a\u7cfb\u7edf\u5c5e\u6027\u4f20\u9012\u7ed9\u5e94\u7528\u7a0b\u5e8f\u3002\u4f8b\u5982\uff0c\u5728Surefire\u63d2\u4ef6\u4e2d\u8bbe\u7f6e\u7cfb\u7edf\u5c5e\u6027\uff1a<\/span><\/p>\n<pre style=\"font-size: 16px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;margin-bottom: 20px;overflow: auto;overflow-wrap: normal;word-break: break-all;padding: 10px;border-width: 1px;border-style: solid;border-color: rgb(217, 217, 217);border-radius: 0px;line-height: 20px;background-color: rgb(40, 44, 52);color: rgb(51, 51, 51);letter-spacing: normal;text-align: start;\"><code style=\"font-size: 12px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;display: block;overflow-x: auto;background: transparent;color: rgb(199, 37, 78);vertical-align: middle;border-width: initial;border-style: none;border-color: initial;\">&lt;<span style=\"color: rgb(224, 108, 117);\">build<\/span>&gt;    &lt;<span style=\"color: rgb(224, 108, 117);\">plugins<\/span>&gt;        &lt;<span style=\"color: rgb(224, 108, 117);\">plugin<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">groupId<\/span>&gt;org.apache.maven.plugins&lt;\/<span style=\"color: rgb(224, 108, 117);\">groupId<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">artifactId<\/span>&gt;maven-surefire-plugin&lt;\/<span style=\"color: rgb(224, 108, 117);\">artifactId<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">version<\/span>&gt;2.22.2&lt;\/<span style=\"color: rgb(224, 108, 117);\">version<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">configuration<\/span>&gt;                &lt;<span style=\"color: rgb(224, 108, 117);\">systemPropertyVariables<\/span>&gt;                    &lt;<span style=\"color: rgb(224, 108, 117);\">basedir<\/span>&gt;${project.basedir}&lt;\/<span style=\"color: rgb(224, 108, 117);\">basedir<\/span>&gt;                &lt;\/<span style=\"color: rgb(224, 108, 117);\">systemPropertyVariables<\/span>&gt;            &lt;\/<span style=\"color: rgb(224, 108, 117);\">configuration<\/span>&gt;        &lt;\/<span style=\"color: rgb(224, 108, 117);\">plugin<\/span>&gt;    &lt;\/<span style=\"color: rgb(224, 108, 117);\">plugins<\/span>&gt;&lt;\/<span style=\"color: rgb(224, 108, 117);\">build<\/span>&gt;<\/code><\/pre>\n<h3 data-line=\"133\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">6. \u5b9a\u4e49\u81ea\u5b9a\u4e49\u811a\u672c<\/span><\/h3>\n<p data-line=\"134\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u5728Maven\u63d2\u4ef6\u4e2d\u6267\u884c\u81ea\u5b9a\u4e49\u811a\u672c\u6216\u547d\u4ee4\u65f6\uff0c\u4f7f\u7528${project.basedir}\u6765\u6307\u5b9a\u811a\u672c\u7684\u4f4d\u7f6e\u3002<\/span><\/p>\n<pre style=\"font-size: 16px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;margin-bottom: 20px;overflow: auto;overflow-wrap: normal;word-break: break-all;padding: 10px;border-width: 1px;border-style: solid;border-color: rgb(217, 217, 217);border-radius: 0px;line-height: 20px;background-color: rgb(40, 44, 52);color: rgb(51, 51, 51);letter-spacing: normal;text-align: start;\"><code style=\"font-size: 12px;font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;display: block;overflow-x: auto;background: transparent;color: rgb(199, 37, 78);vertical-align: middle;border-width: initial;border-style: none;border-color: initial;\">&lt;<span style=\"color: rgb(224, 108, 117);\">build<\/span>&gt;    &lt;<span style=\"color: rgb(224, 108, 117);\">plugins<\/span>&gt;        &lt;<span style=\"color: rgb(224, 108, 117);\">plugin<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">groupId<\/span>&gt;org.apache.maven.plugins&lt;\/<span style=\"color: rgb(224, 108, 117);\">groupId<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">artifactId<\/span>&gt;maven-antrun-plugin&lt;\/<span style=\"color: rgb(224, 108, 117);\">artifactId<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">version<\/span>&gt;1.8&lt;\/<span style=\"color: rgb(224, 108, 117);\">version<\/span>&gt;            &lt;<span style=\"color: rgb(224, 108, 117);\">executions<\/span>&gt;                &lt;<span style=\"color: rgb(224, 108, 117);\">execution<\/span>&gt;                    &lt;<span style=\"color: rgb(224, 108, 117);\">phase<\/span>&gt;package&lt;\/<span style=\"color: rgb(224, 108, 117);\">phase<\/span>&gt;                    &lt;<span style=\"color: rgb(224, 108, 117);\">goals<\/span>&gt;                        &lt;<span style=\"color: rgb(224, 108, 117);\">goal<\/span>&gt;run&lt;\/<span style=\"color: rgb(224, 108, 117);\">goal<\/span>&gt;                    &lt;\/<span style=\"color: rgb(224, 108, 117);\">goals<\/span>&gt;                    &lt;<span style=\"color: rgb(224, 108, 117);\">configuration<\/span>&gt;                        &lt;<span style=\"color: rgb(224, 108, 117);\">target<\/span>&gt;                            &lt;<span style=\"color: rgb(224, 108, 117);\">exec<\/span> <span style=\"color: rgb(209, 154, 102);\">executable<\/span>=<span style=\"color: rgb(152, 195, 121);\">\"${project.basedir}\/scripts\/deploy.sh\"<\/span>&gt;                                &lt;<span style=\"color: rgb(224, 108, 117);\">arg<\/span> <span style=\"color: rgb(209, 154, 102);\">value<\/span>=<span style=\"color: rgb(152, 195, 121);\">\"${project.version}\"<\/span>\/&gt;                            &lt;\/<span style=\"color: rgb(224, 108, 117);\">exec<\/span>&gt;                        &lt;\/<span style=\"color: rgb(224, 108, 117);\">target<\/span>&gt;                    &lt;\/<span style=\"color: rgb(224, 108, 117);\">configuration<\/span>&gt;                &lt;\/<span style=\"color: rgb(224, 108, 117);\">execution<\/span>&gt;            &lt;\/<span style=\"color: rgb(224, 108, 117);\">executions<\/span>&gt;        &lt;\/<span style=\"color: rgb(224, 108, 117);\">plugin<\/span>&gt;    &lt;\/<span style=\"color: rgb(224, 108, 117);\">plugins<\/span>&gt;&lt;\/<span style=\"color: rgb(224, 108, 117);\">build<\/span>&gt;<\/code><\/pre>\n<h3 data-line=\"162\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"color: rgb(255, 76, 65);\"><strong><span style=\"font-size: 16px;\">\u4e09\u3001Maven\u4e2d\u7684\u5176\u4ed6\u5185\u7f6e\u5c5e\u6027<\/span><\/strong><\/span><\/h3>\n<p data-line=\"164\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u9664\u4e86${project.basedir}\uff0cMaven\u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5176\u4ed6\u5e38\u7528\u7684\u5185\u7f6e\u5c5e\u6027\uff1a<\/span><\/p>\n<ul style=\"text-align: left;margin-bottom: 32px;\" class=\"list-paddingleft-1\">\n<li style=\"text-align: left;margin-bottom: 32px;\">\n<p style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">${project.version}\uff1a\u9879\u76ee\u7684\u7248\u672c<\/span><\/p>\n<\/li>\n<li style=\"text-align: left;margin-bottom: 32px;\">\n<p style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">${project.artifactId}\uff1a\u9879\u76ee\u7684artifactId<\/span><\/p>\n<\/li>\n<li style=\"text-align: left;margin-bottom: 32px;\">\n<p style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">${project.groupId}\uff1a\u9879\u76ee\u7684groupId<\/span><\/p>\n<\/li>\n<li style=\"text-align: left;margin-bottom: 32px;\">\n<p style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">${project.build.directory}\uff1a\u6784\u5efa\u76ee\u5f55\uff0c\u901a\u5e38\u4e3atarget<\/span><\/p>\n<\/li>\n<\/ul>\n<p data-line=\"171\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u8fd9\u4e9b\u5c5e\u6027\u90fd\u662f\u7531Maven\u6839\u636epom.xml\u4e2d\u7684\u914d\u7f6e\u548c\u9879\u76ee\u7ed3\u6784\u81ea\u52a8\u751f\u6210\u548c\u7ba1\u7406\u7684\u3002<\/span><\/p>\n<h3 data-line=\"173\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"color: rgb(255, 76, 65);\"><strong><span style=\"font-size: 16px;\">\u56db\u3001\u6700\u540e\u603b\u7ed3<\/span><\/strong><\/span><\/h3>\n<p data-line=\"175\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u901a\u8fc7\u4ee5\u4e0a\u7684\u4e86\u89e3\uff0c\u53ef\u4ee5\u53d1\u73b0${project.basedir}\u5728Maven\u7684pom.xml\u4e2d\u975e\u5e38\u6709\u7528\uff0c\u53ef\u4ee5\u7075\u6d3b\u5730\u5f15\u7528\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u7684\u5404\u79cd\u8d44\u6e90\u548c\u6587\u4ef6\uff0c\u7b80\u5316\u914d\u7f6e\uff0c\u589e\u5f3a\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/span><\/p>\n<p data-line=\"175\" style=\"text-align: left;margin-bottom: 32px;\"><span style=\"font-size: 16px;\">\u603b\u7684\u6765\u8bf4\uff0c${project.basedir}\u662fMaven\u81ea\u52a8\u63d0\u4f9b\u7684\u4e00\u4e2a\u6307\u5411\u9879\u76ee\u6839\u76ee\u5f55\u7684\u5185\u7f6e\u5c5e\u6027\uff0c\u4e0d\u9700\u8981\u663e\u5f0f\u5b9a\u4e49\uff0c\u53ef\u76f4\u63a5\u5728pom.xml\u4e2d\u4f7f\u7528\u3002<\/span><span style=\"font-size: 16px;letter-spacing: 0.034em;\"><\/span><\/p>\n<p style=\"display: none;\"><mp-style-type data-value=\"3\"><\/mp-style-type><\/p>\n<blockquote>\n<p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7:                 \u7a0b\u5c31\u4eba\u751f              <\/p>\n<\/blockquote>\n<\/div>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\u5728\u4f7f\u7528 Spring Boot \u505a\u9879\u76ee\u7684\u65f6\u5019\uff0c\u7ecf\u5e38\u4f1a\u4f7f\u7528\u4e00\u4e9b\u7b2c\u4e09\u65b9jar\u5305\uff0c\u6709\u4e9bjar\u5305\u5728Maven\u4ed3\u5e93https:\/\/mvnre &#8230;<\/p>\n","protected":false},"author":1,"featured_media":5825,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[7],"tags":[],"class_list":["post-5837","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring-boot"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801222800230-150x150.jpeg","content_first_image":null,"post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801222800230-300x128.jpeg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801222800230.jpeg","post_frist_image":null,"post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801222800230-300x128.jpeg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801222800230.jpeg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/08\/20240801222800230.jpeg","post_all_images":[],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Spring Boot","post_date":"2024-08-01","like_count":"0","praiseWord":"\u9f13\u52b1","copyright_state":"","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230519082947553.jpg","avatarurls":[],"related_posts":null,"pageviews":963,"next_post_id":6197,"next_post_title":"SpringBoot+mail \u8f7b\u677e\u5b9e\u73b0\u5404\u7c7b\u90ae\u4ef6\u81ea\u52a8\u63a8\u9001","previous_post_id":5843,"previous_post_title":"Vue\u6253\u5305\u6587\u4ef6dist\u653e\u5728SpringBoot\u9879\u76ee\u4e0b\u8fd0\u884c\uff08\u6b63\u786e\u5b9e\u73b0\u5168\u8fc7\u7a0b\uff09","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/5837","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=5837"}],"version-history":[{"count":1,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/5837\/revisions"}],"predecessor-version":[{"id":6272,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/5837\/revisions\/6272"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/5825"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=5837"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=5837"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=5837"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}