maven Series - multi-multi-module Web application package merger War

Multiple Web maven multi-module application package is based on the merger War up basics of the last chapter of my sub-sub-module project management writing, to see if this part requires a combination of the previous chapter "maven sub-sub-module project management" to begin .

I'm a top-level parent of this project is divided into five sub-level modules and engineering projects, projects have been successfully established.

I would want this project and customer management customermgr goodsmgrweb project to merge and create a new architectureweb in jsp, js file and the corresponding file in the corresponding project, and will run customermgr respectively, goodsmgrweb, architectureweb module alone, take a look at the sub-module maven convenience of the partition project management.

1.architectureweb To configure customermgr, goodsmgrweb of its dependencies.

Code:

 

<dependencies>
		<dependency>
			<groupId>com.hxqc</groupId>
			<artifactId>customermgr</artifactId>
			<version>0.0.1-SNAPSHOT</version>
			<type>war</type>
		</dependency>
		<dependency>
			<groupId>com.hxqc</groupId>
			<artifactId>goodsmgrweb</artifactId>
			<version>0.0.1-SNAPSHOT</version>
			<type>war</type>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
	<build>
		<finalName>architectureweb</finalName>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>3.0.0</version>
				<configuration>
					<overlays>
						<overlay>
							<groupId>com.hxqc</groupId>
							<artifactId>customermgr</artifactId>
						</overlay>
						<overlay>
							<groupId>com.hxqc</groupId>
							<artifactId>goodsmgrweb</artifactId>
						</overlay>
					</overlays>
				</configuration>
			</plugin>

 

 

 

 

 

2. In the common public resource module then calls the new java class Base1 Base1 in customermgr the way to see the effect of the merger.

3. In new class customermgr the customer1 then write a method, the new file customermgr other jsp, folder, js and writes output related methods. Too many files locked method is not one to show each js or jsp files can write output mainly to see the effect with.

Customermgr earlier injected common dependence upon methods common in base1 class call jsp file, otherwise will complain reference import base1 class.

4. Commodity Admin goodsmgr project in New goods1 class called look-dependent effect of the merger in goodsmgrweb in.

The merchandise management goodsmgrweb management page, there is similar to the new customermgr js, jsp file input file to do some of the output was observed in the project structure shown in FIG.

Since the call goods inside the class and method goodsmgr in goodsmgrweb inside the jsp page, so they will have in goodsmgrweb injection goodsmgr otherwise jsp file error.

6. The total project architecture right ---> run as ---> maven install architecturex project is structured as follows.

The time to find the directory file submodule a.jsp overlapping portions combined only take one, here we are in the order of time-dependent configuration to take.

So sub-module project management of the new treatment to distinguish between the various documents, to avoid duplication of the same path with the file name.

7. Run the project, for example running goodsmgrweb project, architectureweb, customermgr not run a similar one by one example.

First, configure goodsmgrweb pom.xml file to the jetty plugin configuration.

 

<plugins>
	<plugin>
		<groupId>org.mortbay.jetty</groupId>
		<artifactId>jetty-maven-plugin</artifactId>
		<version>8.1.16.v20140903</version>
		<configuration>
			<scanIntervalSeconds>10</scanIntervalSeconds>
			<stopPort>9999</stopPort>
			<webApp>
				<contextPath>/goods</contextPath>
			</webApp>
		<connectors>
			<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
			        <port>9080</port>
			        <maxIdleTime>60000</maxIdleTime>
			</connector>
			<!-- <connector implementation="org.eclipse.jetty.server.ssl.SslSelectChannelConnector"> 
			<port>9443</port> <password>changeit</password> </connector> -->
			</connectors>
		</configuration>
	</plugin>
</plugins>

 

 

 

右键goodsmgrweb ---> run as --->run configurations (jetty:run)

Successful operation will appear:

 

[INFO] Classes = D:\Workspaces\architecture\goodsmgrweb\target\classes
[INFO] Context path = /goods
[INFO] Tmp directory = D:\Workspaces\architecture\goodsmgrweb\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = file:/D:/Workspaces/architecture/goodsmgrweb/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = D:\Workspaces\architecture\goodsmgrweb\src\main\webapp
[INFO] jetty-8.1.16.v20140903
[INFO] No Transaction manager found - if your webapp requires one, please configure one.
[WARNING] !RequestLog
[INFO] Started [email protected]:9080
[INFO] Started Jetty Server
[INFO] Starting scanner at interval of 10 seconds.


Then visit the effect is as follows:

 

 

 

 

 

Published 215 original articles · won praise 135 · Views 1.14 million +

Guess you like

Origin blog.csdn.net/weinichendian/article/details/62422188