看看下面這段pom配置
<code>...</code>
<code><</code><code>dependency</code><code>></code>
<code> </code><code><</code><code>groupId</code><code>>xxx</</code><code>groupId</code><code>></code>
<code> </code><code><</code><code>artifactId</code><code>>yyy</</code><code>artifactId</code><code>></code>
<code> </code><code><</code><code>type</code><code>>ejb</</code><code>type</code><code>></code>
<code></</code><code>dependency</code><code>></code>
這個<type>很多maven相關的資料中都未曾提及,而上網搜了一下中文資源,這些文章都把compile、runtime、test等本屬于scope的概念混淆為“依賴類型”<type>的概念。而且,關于這個<type>的解釋也非常少。
我也是看了Maven 3 Cookbook之後從中找到些隻言片語,反推出type的作用。
看書中原文(P134. How it works...):
Adding the type of apk to the dependency allows the Maven Android plugin to find the Android package of the application.
不難看出,<type>apk</type>告訴maven使用maven android plugin來進行處理<type>為apk的依賴。進而推想<type>ejb</type>就是告訴maven使用maven ejb plugin來處理。如果想知道ejb plugin如何處理這類dependency,那就去查查ejb plugin的詳細說明吧,這個plugin的說明網上有很多。
本文轉自 rickqin 51CTO部落格,原文連結:http://blog.51cto.com/rickqin/1738774