﻿{"id":1059,"date":"2015-05-08T18:55:42","date_gmt":"2015-05-08T10:55:42","guid":{"rendered":"http:\/\/zerobox.org\/notes\/?p=1059"},"modified":"2016-06-02T19:36:23","modified_gmt":"2016-06-02T11:36:23","slug":"opengl%e4%b8%ad%e4%b8%80%e7%a7%8d%e9%ab%98%e6%95%88%e7%9a%84%e7%ba%bf%e6%ae%b5%e5%8f%8d%e8%b5%b0%e6%a0%b7%e6%8a%80%e6%9c%af","status":"publish","type":"post","link":"http:\/\/zerobox.org\/notes\/1059.html","title":{"rendered":"Java \u7f16\u8bd1\u671f\u4ee3\u7801\u751f\u6210\u906d\u9047 Maven \u589e\u91cf\u7f16\u8bd1"},"content":{"rendered":"<p>\u6625\u8282\u671f\u95f4\u6211\u5f04\u4e86\u4e00\u4e2a\u4e1c\u897f\uff0c\u6211\u628a\u5b83\u53eb\u505a\u201c\u9ed1\u79d1\u6280\u201d\uff0c\u7528\u5230\u4e86\u7f16\u8bd1\u671f\u4ee3\u7801\u751f\u6210\u6280\u672f\u3002Demo \u505a\u51fa\u6765\u4e4b\u540e\u6211\u5f88\u662f\u5f00\u5fc3\u4e86\u4e00\u6bb5\u65f6\u95f4\uff0c\u56e0\u4e3a\u5b83\u5728\u6027\u80fd\u4e0a\u80fd\u591f\u628a\u73b0\u6709\u7684\u53c2\u8003\u5b9e\u73b0\u7529\u51e0\u6761\u8857\uff0c\u6bd5\u7adf\u539f\u751f\u4ee3\u7801\u7684\u6027\u80fd\u6bd4\u53cd\u5c04\u4e0d\u77e5\u9053\u9ad8\u5230\u54ea\u91cc\u53bb\uff0c\u800c\u53c2\u8003\u5b9e\u73b0\u6070\u6070\u662f\u7528\u53cd\u5c04\u5b9e\u73b0\u7684\u3002\u867d\u7136\u6211\u7684\u5b9e\u73b0\u5728\u6269\u5c55\u6027\u4e0a\u6bd4\u53c2\u8003\u5b9e\u73b0\u5f31\u4e86\u4e00\u4e9b\uff0c\u800c\u4e14\u5199\u4ee3\u7801\u7684\u65f6\u5019 IDEA \u603b\u662f\u4e0d\u8bc6\u76f8\u7684\u62a5\u544a\u627e\u4e0d\u5230\u7c7b\u5b9a\u4e49\u2026\u2026IDEA \u627e\u4e0d\u5230\u7c7b\u7684\u8bdd\uff0c\u6211\u53ea\u8981\u6267\u884c\u7f16\u8bd1\u628a\u4ee3\u7801\u751f\u6210\u51fa\u6765\u5c31\u597d\u4e86\uff0c\u6269\u5c55\u6027\u540e\u9762\u6211\u4f1a\u641e\u5b9a\u7684\u3002<\/p>\n<p>\u8fd9\u51e0\u5929\u6211\u5728\u505a\u9879\u76ee\u7684\u65f6\u5019\uff0c\u82b1\u4e86\u51e0\u4e2a\u5c0f\u65f6\u628a\u8fd9\u4e2a\u9ed1\u79d1\u6280\u4ece\u6211\u7684 Demo \u9879\u76ee\u8fc1\u79fb\u5230\u4e86\u751f\u4ea7\u4ee3\u7801\u4e2d\uff0c\u7136\u540e\u505a\u4e86\u5927\u91cf\u7684\u6539\u8fdb\u3002<\/p>\n<p>\u8fd9\u51e0\u5929\u5199\u4ee3\u7801\u7684\u59ff\u52bf\u8ddf\u4e4b\u524d\u5b8c\u5168\u4e0d\u540c\uff0c\u4e4b\u524d\u662f\u5199\u4e00\u70b9\u63d0\u4ea4\u4e00\u70b9\uff0c\u7136\u540e\u5230\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u8d77\u6765\u8c03\u8bd5\u3002\u524d\u6bb5\u65f6\u95f4\u6211\u5728 Docker \u5f04\u4e86\u4e00\u5957\u6dd8\u7cfb\u5e94\u7528\u7684\u7f16\u8bd1\u90e8\u7f72\u73af\u5883\uff0c\u7136\u540e\u8fd9\u51e0\u5929\u6211\u7684\u4ee3\u7801\u90fd\u662f\u5728\u5bb9\u5668\u91cc\u7f16\u8bd1\u90e8\u7f72\u7684\uff0c\u76f4\u5230\u4eca\u5929\u4e0b\u5348\u624d\u7533\u8bf7\u4e86\u4e00\u4e2a\u9879\u76ee\u73af\u5883\u51fa\u6765\u3002<\/p>\n<p>\u6545\u4e8b\u662f\u4ece\u7f16\u8bd1\u5931\u8d25\u5f00\u59cb\u7684\u3002<\/p>\n<h1 id=\"\u56f0\u5c40\">\u56f0\u5c40<\/h1>\n<p>\u6211\u628a\u4ee3\u7801\u7b7e\u5165\u4e4b\u540e\uff0c\u5728\u5f00\u59cb\u5728\u9879\u76ee\u73af\u5883\u90e8\u7f72\u4ee3\u7801\u3002\u56e0\u4e3a\u4e4b\u524d\u6211\u5df2\u7ecf\u5728\u5bb9\u5668\u4e2d\u591a\u6b21\u7f16\u8bd1\u90e8\u7f72\uff0c\u8fd9\u6b21\u53ea\u4e0d\u8fc7\u662f\u6362\u4e86\u4e2a\u73af\u5883\uff0c\u60f3\u5fc5\u95ee\u9898\u4e0d\u5927\u3002\u8fc7\u4e86\u4e00\u4f1a\u518d\u770b\uff0c\u5c45\u7136\u7f16\u8bd1\u5931\u8d25\u4e86\uff01\uff01\uff01<\/p>\n<p>\u5728\u6211\u7684\u673a\u5668\u4e0a\u660e\u660e\u662f\u597d\u7684\uff01Docker \u771f\u662f\u4e2a\u4f1f\u5927\u7684\u4ea7\u54c1\uff0c\u8981\u662f\u80fd\u76f4\u63a5\u628a\u6211\u672c\u5730\u7684\u5bb9\u5668\u6254\u670d\u52a1\u5668\u4e0a\u8be5\u591a\u597d\u3002\u73b0\u5b9e\u5f88\u6b8b\u9177\uff0c\u6211\u5fc5\u987b\u89e3\u51b3\u95ee\u9898\u3002\u4ed4\u7ec6\u770b\u4e86\u770b\u9519\u8bef\u65e5\u5fd7\uff0c\u662f\u4e00\u4e2a\u719f\u6089\u7684\u9519\u8bef\uff1a<\/p>\n<pre><code class=\"hljs css\"><span class=\"hljs-attr_selector\">[INFO]<\/span> <span class=\"hljs-attr_selector\">[compiler:compile {execution: default-compile}]<\/span>\r\n<span class=\"hljs-attr_selector\">[INFO]<\/span> <span class=\"hljs-tag\">Changes<\/span> <span class=\"hljs-tag\">detected<\/span> <span class=\"hljs-tag\">-<\/span> <span class=\"hljs-tag\">recompiling<\/span> <span class=\"hljs-tag\">the<\/span> <span class=\"hljs-tag\">module<\/span>!\r\n<span class=\"hljs-attr_selector\">[INFO]<\/span> <span class=\"hljs-tag\">-------------------------------------------------------------<\/span>\r\n<span class=\"hljs-attr_selector\">[ERROR]<\/span> <span class=\"hljs-tag\">COMPILATION<\/span> <span class=\"hljs-tag\">ERROR<\/span> : \r\n<span class=\"hljs-attr_selector\">[INFO]<\/span> <span class=\"hljs-tag\">-------------------------------------------------------------<\/span>\r\n<span class=\"hljs-attr_selector\">[ERROR]<\/span> <span class=\"hljs-tag\">xxxxxx<\/span><span class=\"hljs-class\">.java<\/span>:<span class=\"hljs-attr_selector\">[4,8]<\/span> <span class=\"hljs-tag\">duplicate<\/span> <span class=\"hljs-tag\">class<\/span>: <span class=\"hljs-tag\">com<\/span><span class=\"hljs-class\">.taobao<\/span><span class=\"hljs-class\">.xxxx<\/span>\r\n<span class=\"hljs-attr_selector\">[ERROR]<\/span> <span class=\"hljs-tag\">xxxxxx<\/span><span class=\"hljs-class\">.java<\/span>:<span class=\"hljs-attr_selector\">[4,8]<\/span> <span class=\"hljs-tag\">duplicate<\/span> <span class=\"hljs-tag\">class<\/span>: <span class=\"hljs-tag\">com<\/span><span class=\"hljs-class\">.taobao<\/span><span class=\"hljs-class\">.xxxx<\/span>\r\n<span class=\"hljs-attr_selector\">[INFO]<\/span> 2 <span class=\"hljs-tag\">errors<\/span> \r\n<\/code><\/pre>\n<p>\u8fd9\u4e2a\u5f02\u5e38\u4fe1\u606f\u662f\u6211\u521a\u5f00\u59cb\u5f00\u53d1\u9ed1\u79d1\u6280\u7684\u65f6\u5019\u7ecf\u5e38\u9047\u5230\u7684\uff0c\u5c31\u662f\u5728\u7f16\u8bd1\u7684\u65f6\u5019\u91cd\u590d\u751f\u6210\u4e86\u76f8\u540c\u7684\u7c7b\uff0c\u7136\u540e\u8fd9\u4e2a\u9519\u8bef\u5c31\u51fa\u73b0\u4e86\u3002<\/p>\n<p>\u81ea\u4ece\u6211\u628a Demo \u5f00\u53d1\u51fa\u6765\u4e4b\u540e\uff0c\u5c31\u518d\u4e5f\u6ca1\u6709\u51fa\u73b0\u8fd9\u4e2a\u9519\u8bef\u4e86\uff0c\u8fd9\u6b21\u51fa\u73b0\u662f\u4ec0\u4e48\u539f\u56e0\uff0c\u6216\u8005\u5728\u4e0d\u77e5\u9053\u539f\u56e0\u7684\u60c5\u51b5\u4e0b\u6211\u8be5\u600e\u4e48\u641e\u5b9a\u5b83\uff1f<\/p>\n<h1 id=\"\u6293\u778e\">\u6293\u778e<\/h1>\n<p>\u9996\u5148\u6211\u8bd5\u7740\u7f16\u8bd1\u4ee3\u7801\uff0c\u786e\u8ba4\u672c\u5730\u4e0d\u4f1a\u51fa\u73b0\u8fd9\u79cd\u60c5\u51b5\u3002<\/p>\n<pre><code class=\"hljs nginx\"><span class=\"hljs-title\">mvn<\/span> clean install -DskipTests\r\n<\/code><\/pre>\n<p>\u4e00\u5207\u6b63\u5e38\u3002\u4e0d\u4fe1\u90aa\u7684\u6211\u8fde\u7eed\u5728\u9875\u9762\u4e0a\u70b9\u4e86\u597d\u51e0\u6b21\u7f16\u8bd1\u90e8\u7f72\uff0c\u9519\u8bef\u4f9d\u65e7\u3002<\/p>\n<p>\u4e00\u65f6\u95f4\u65e0\u8ba1\u53ef\u65bd\uff0c\u53ea\u597d\u778e\u6298\u817e\uff0c\u8fd9\u91cc\u6539\u6539\u90a3\u91cc\u6539\u6539\uff0c\u628a\u8fd9\u4e2a\u5f02\u5e38\u541e\u6389\uff0c\u628a\u90a3\u6bb5\u4ee3\u7801\u6ce8\u91ca\u2026\u2026\u56fe\u7075\u5927\u4eba\u66fe\u7ecf\u8bf4\u8fc7\uff0c\u4e0d\u52a8\u8111\u5b50\u4e71\u6539\u4ee3\u7801\u662f\u89e3\u51b3\u4e0d\u4e86\u95ee\u9898\u7684\u3002\u679c\u7136\uff0c\u6539\u4e86\u534a\u5929\u8fd8\u662f\u6ca1\u6709\u7ed3\u679c\u3002<\/p>\n<p>\u5fc3\u60c5\u8d8a\u6765\u8d8a\u6c89\u91cd\uff0c\u5982\u679c\u641e\u4e0d\u5b9a\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u7684\u9ed1\u79d1\u6280\u5c31\u53ea\u80fd\u662f\u4e2a\u73a9\u5177\uff0c\u7136\u540e\u6211\u5c31\u4e0d\u5f97\u4e0d\u5728\u751f\u4ea7\u4ee3\u7801\u91cc\u4eba\u8089\u7f16\u5199\u5927\u91cf\u67af\u71e5\u65e0\u5473\u7684\u4ee3\u7801\u3002<\/p>\n<p>\u9ad8\u5fb7\u7eb3\u4e3a\u4f60\u5173\u4e0a\u4e86\u4e00\u6247\u95e8\uff0c\u4e5f\u4f1a\u4e3a\u4f60\u6253\u5f00\u4e00\u6247\u7a97\u3002\u6211\u5f00\u59cb\u4ece\u590d\u73b0\u7f16\u8bd1\u9519\u8bef\u8fd9\u6761\u8def\u4e0a\u4e0b\u5de5\u592b\u3002\u4ed4\u7ec6\u5bf9\u6bd4\u4e86\u6211\u672c\u5730\u7f16\u8bd1\u7684\u65e5\u5fd7\u548c\u7f16\u8bd1\u670d\u52a1\u5668\u8f93\u51fa\u7684\u65e5\u5fd7\u4e4b\u540e\u53d1\u73b0\uff0c\u6211\u672c\u5730\u7684\u7f16\u8bd1\u4efb\u52a1\u603b\u662f clean compile\uff0c\u800c\u7f16\u8bd1\u670d\u52a1\u5668\u7684\u7f16\u8bd1\u4efb\u52a1\u603b\u662f compile\u3002<\/p>\n<p>\u4f1a\u4e0d\u4f1a\u8fd9\u4e2a clean \u4efb\u52a1\u5c31\u6210\u4e86\u95ee\u9898\u7684\u5173\u952e\uff1f<\/p>\n<h1 id=\"\u53c2\u6570\">\u53c2\u6570<\/h1>\n<p>\u5148\u6267\u884c clean \u6e05\u7406\u4e00\u4e0b\uff0c\u7136\u540e\u8fde\u7eed\u6267\u884c\u4e24\u6b21 compile\uff0c\u9519\u8bef\u7c97\u7ebf\u4e86\uff0c\u548c\u7f16\u8bd1\u670d\u52a1\u5668\u663e\u793a\u7684\u4e00\u6a21\u4e00\u6837\uff01<\/p>\n<p>\u5c45\u7136\u662f\u56e0\u4e3a\u4e0a\u6b21\u7f16\u8bd1\u4ea7\u751f\u7684\u4ee3\u7801\uff0c\u5728\u8fd9\u6b21\u7f16\u8bd1\u4e4b\u524d\u6ca1\u6709\u6e05\u7406\uff0c\u5bfc\u81f4\u7b2c\u4e8c\u6b21\u7f16\u8bd1\u7684\u65f6\u5019\u4ea7\u751f\u4e86\u4e00\u6837\u7684\u7c7b\uff0c\u4e8e\u662f\u906d\u9047 duplicate class\u3002<\/p>\n<p>\u597d\u5427\uff0c\u867d\u7136\u6211\u80fd\u91cd\u73b0\u95ee\u9898\u4e86\uff0c\u800c\u4e14\u6211\u8fd8\u77e5\u9053\u662f\u56e0\u4e3a\u589e\u91cf\u7f16\u8bd1\u5bfc\u81f4\u7684\u95ee\u9898\uff0c\u4f46\u662f\u95ee\u9898\u8be5\u600e\u4e48\u89e3\u51b3\uff0c\u6211\u8fd8\u662f\u4e1d\u6beb\u6ca1\u6709\u5934\u7eea\u3002\u867d\u7136\u660e\u77e5\u9053\u662f\u7f16\u8bd1\u811a\u672c\u6709\u7f3a\u9677\uff0c\u5982\u679c\u7f16\u8bd1\u547d\u4ee4\u4e2d\u5e26\u6709 clean \u5c31\u59a5\u59a5\u7684\u4e0d\u4f1a\u6709\u95ee\u9898\u4e86\u3002\u4f46\u662f\u8fd9\u662f\u76ee\u524d\u6807\u51c6\u7684\u7f16\u8bd1\u811a\u672c\uff0c\u4eba\u5bb6\u624d\u4e0d\u4f1a\u4e3a\u4e86\u6211\u4e00\u4e2a\u5c0f\u5c0f\u7684\u9ed1\u79d1\u6280\u4fee\u6539\u96c6\u56e2\u901a\u7528\u7684\u811a\u672c\u5462\u3002<\/p>\n<p>\u6211\u53c8\u8981\u5f00\u59cb\u9762\u5411 Google \u548c StackOverflow \u7684\u7a0b\u5e8f\u8bbe\u8ba1\u4e86\u3002\u4e00\u756a\u641c\u7d22\u4e4b\u540e\uff0c\u6211\u53d1\u73b0\u4e86 Maven \u7f16\u8bd1\u63d2\u4ef6 maven-compiler-plugin \u6709\u4e00\u4e2a\u53c2\u6570\uff0c\u4f3c\u4e4e\u80fd\u5e2e\u6211\u89e3\u51b3\u95ee\u9898<sup class=\"footnote-ref\"><a id=\"fnref1\" href=\"http:\/\/blog.jamespan.me\/2015\/05\/06\/mvn-incremental-compilation\/#fn1\">[1]<\/a><\/sup>\u3002<\/p>\n<p>\u8fd9\u4e2a\u53c2\u6570\u5c31\u662f useIncrementalCompilation<sup class=\"footnote-ref\"><a id=\"fnref2\" href=\"http:\/\/blog.jamespan.me\/2015\/05\/06\/mvn-incremental-compilation\/#fn2\">[2]<\/a><\/sup>\u3002<\/p>\n<p>\u914d\u7f6e\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-xml hljs\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">plugin<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">artifactId<\/span>&gt;<\/span>maven-compiler-plugin<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">artifactId<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">configuration<\/span>&gt;<\/span>\r\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">source<\/span>&gt;<\/span>1.7<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">source<\/span>&gt;<\/span>\r\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">target<\/span>&gt;<\/span>1.7<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">target<\/span>&gt;<\/span>\r\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">encoding<\/span>&gt;<\/span>UTF-8<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">encoding<\/span>&gt;<\/span>\r\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-title\">useIncrementalCompilation<\/span>&gt;<\/span>false<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">useIncrementalCompilation<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">configuration<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-title\">plugin<\/span>&gt;<\/span>\r\n<\/code><\/pre>\n<p>\u641e\u5b9a\uff01\u9057\u61be\u7684\u662f\uff0c\u6bcf\u4e2a\u8981\u7528\u6211\u7684\u9ed1\u79d1\u6280\u7684\u6a21\u5757\uff0c\u90fd\u5f97\u5728 pom \u91cc\u9762\u52a0\u4e0a\u8fd9\u4e2a\u53c2\u6570\u914d\u7f6e\u4e86\u3002<\/p>\n<p>\u7528 Maven \u7684\u65f6\u5019\u5e26\u4e0a clean \u662f\u4e2a\u597d\u4e60\u60ef\uff01<\/p>\n<p>&nbsp;<\/p>\n<p>\u6765\u6e90:http:\/\/blog.jamespan.me\/2015\/05\/06\/mvn-incremental-compilation\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6625\u8282\u671f\u95f4\u6211\u5f04\u4e86\u4e00\u4e2a\u4e1c\u897f\uff0c\u6211\u628a\u5b83\u53eb\u505a\u201c\u9ed1\u79d1\u6280\u201d\uff0c\u7528\u5230\u4e86\u7f16\u8bd1\u671f\u4ee3\u7801\u751f\u6210\u6280\u672f\u3002Demo &hellip;<\/p>\n<p class=\"read-more\"><a href=\"http:\/\/zerobox.org\/notes\/1059.html\">\u7ee7\u7eed\u9605\u8bfb &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[96,238],"class_list":["post-1059","post","type-post","status-publish","format-standard","hentry","tag-java","tag-opengl"],"views":1060,"_links":{"self":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts\/1059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/comments?post=1059"}],"version-history":[{"count":0,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts\/1059\/revisions"}],"wp:attachment":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/media?parent=1059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/categories?post=1059"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/tags?post=1059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}