Copy and paste the places that need to be changed in the java web project managed by maven

       Iterative phenomenon is inevitable in the phased development of the project. Maybe the next version will make a lot of changes based on the source code of the previous version. In order not to affect the normal use of the original version, it is necessary to copy the original java web project to the new project. After using maven to manage the spring mvc project, after copying and pasting it into the new project, to distinguish the original project, you need to modify the following places:

 

     1.pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.companyName</groupId>
  <artifactId>oldproject</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>oldproject Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
  	<dependency>
  		<groupId>junit</groupId>
  		<artifactId>junit</artifactId>
  		<version>4.11</version>
  	</dependency>
  	<dependency>
  		<groupId>org.apache.httpcomponents</groupId>
  		<artifactId>httpclient</artifactId>
  		<version>4.3.4</version>
  	</dependency>

Replace oldproject in the content of the above <artifactId> and <name> tags with the new project name.

 

2.web.xml

Just change the display name to the new project name.

<display-name>oldproject</display-name>

 

3.org.eclipse.wst.common.component

This file is located in the .settings directory of the project expansion,

<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="oldproject">
        <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
        <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
        <property name="context-root" value="oldproject"/>
        <property name="java-output-path" value="/oldproject/target/classes"/>
    </wb-module>
</project-modules>

        Put the above deployment name <wb-module deploy-name="oldproject">,

context-root属性<property name="context-root" value="oldproject"/>以及

Replace oldproject in the java-output-path property <property name="java-output-path" value="/oldproject/target/classes"/> with the new project name.

 

        After the above changes, the web server can be restarted at this point, and the old and new projects can run in parallel.

        

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326334686&siteId=291194637