Turn "maven Combat (V)---Two war package calls

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.