war項目分別打成JAR和WAR,並被其他項目依賴
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3</version>
<configuration>
<includes>
<include>com/**</include>
</includes>
</configuration>
<executions>
<execution>
<id>make-a-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>api</classifier>
</configuration>
</execution>
</executions>
</plugin>
<!--引入基礎war包
-->
<dependency>
<groupId>com.hnjz</groupId>
<artifactId>hnjz-web-basic</artifactId>
<version>${hnjz.basic.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.hnjz</groupId>
<artifactId>hnjz-web-basic</artifactId>
<version>${hnjz.basic.version}</version>
<type>jar</type>
<scope>compile</scope>
<classifier>api</classifier>
</dependency>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<!--依賴的war項目,默認在target/war/work中,然後被打包進war文件,指定後爲target/work
-->
<workDirectory>${project.build.directory}/work</workDirectory>
<!-- 告訴maven-war-plugin另一個路徑"WebContent",產生的結果就是,執行mvn
package時,war-plugin和warpath-plugin會將當前war和所有依賴的war的web資源都拷貝到該WebContent目錄下.這樣,WebContent目錄包含的內容就是最終打包成WAR的內容了
,如果不指定,默認情況下是在 target目錄下生成一個,war包解壓後的文件夾-->
<!-- <webappDirectory>WebContent</webappDirectory> -->
<useCache>false</useCache>
<archive>
<addMavenDescriptor>true</addMavenDescriptor>
</archive>
<overlays>
<overlay>
<groupId>com.hnjz</groupId>
<artifactId>hnjz-web-basic</artifactId>
</overlay>
<overlay>
<!-- empty groupId/artifactId is detected as the current build -->
<!-- 代表當前WAR項目,默認情況當前WAR項目是先被拷貝,如果要控制其順序,則使用空的overlay
-->
<!-- any other overlay will be applied after the current build since
they have not been configured in the overlays element -->
</overlay>
</overlays>
<!-- 排除依賴war包中的哪些文件
<dependentWarExcludes>*/web.xml,WEB-INF/lib/*,/sql-map-config.xml,/jdbc.properties,/META-INF/*</dependentWarExcludes>
-->
<dependentWarExcludes>/META-INF/*</dependentWarExcludes>
</configuration>
</plugin>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.