Original blog from: http://blog.csdn.net/liutengteng130/article/details/42879803 thanks!
Prerequisites
1. Why use two war package calls?
because we Maven project each War package is a line, front desk with Easyui, and each line to refer to Easyui related js,CSS , and there are some other styles. In order to take out these repetitive things, I made a war bag and put these things in.
2. Why not use jar package?
hit a common jar package, the resources into the, but can not be quoted. Time was urgent and no other solution was tried. The final War package is implemented.
Realize
1. Add the following dependencies to the Web tier that needs to reference the resource:
<!--for Unified control version--
<easyui.version>0.0.1-SNAPSHOT</easyui.version>
<dependency>
<groupId>com.tgb</groupId>
<artifactId>itoo-easyui</artifactId>
<version>${easyui.version}</version>
<type>war</type>
</dependency>
type is the form of the war , representing the time when packaging the appropriate resources into the current Web project, in the form of the following forms exist,
Instead of being presented in the form of a war package.
2. Add a reference to your own JSP page
<% @include file= "/common.jsp"%>
You can use the Include tag.
So we're going to pull the same thing out of the Web . The above is the JSP file in the reference war , but if we need to reference the class file inside, then we need to add a default value to the Pom file in the referenced war as follows:
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<attachClasses>true</attachClasses>
</configuration>
</plugin>
</plugins>
</build>
Summarize:
by playing into a war package, so that our repetitive things are greatly reduced, fully embodies the characteristics of encapsulation, reusability. We always make progress in the constant abstraction, and the project is getting better.
Turn "maven Combat (V)---Two war package calls