Eclipse change maven project name

1. Modify the project name in Eclipse

Yes, this method is as simple as you might expect, once the project has been imported into Eclipse, there are only two things to do

1.1 Change the project folder name

Select the item and press F12 to rename it.

Most people only did this step when changing the project name, but later found that it did not play a real role, such as copying an original project into a new project, then pressing F2 to change the file name, and then deploying the project to tomcat , you will see tomcat prompting that a project with the same name has already been deployed. The "same name" prompted by tomcat obviously refers not to the file name, but to something else.

1.2 Change the project component name

Select the project, right-click and select Properties, enter web in the input box at the top of the left menu bar, select Web Project Settings, enter the project name to be changed in the Context root on the right, OK.

After this step is completed, the name of the WEB project is really changed. In fact, the configuration name of the WEB project needs to be changed in the work of "changing the project name".

2. Manually change the project configuration

This approach can finally achieve the effect of changing the project name, but the work done by Eclipse in Method 1 is done manually.

2.1 Change the project configuration

Find the project folder, open the .settings folder, and find the org.eclipse.wst.common.component file. The file structure is as follows:

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

Change all xxx in the file to the name you want to change, such as yyy

org.eclipse.wst.common.component This file is the component configuration file of the eclipse web project, which configures the source path of the web project and the output path of the compiled code. You can also see the Context root modified in method 1.2, which is the file root path.

After completing this step, the renaming of the common WEB project has been completed. If it is a Maven project, one more step needs to be done, and the pom.xml configuration needs to be changed.

 

2.2 Change pom.xml configuration (Maven project)

Open the pom.xml file and modify the following three configurations, xxx is the original project name

<artifactId>xxx</artifactId>
<name>xxx Maven Webapp</name>
<finalName>xxx</finalName>

 

Transfer: http://blog.csdn.net/shuangzhi_linlin/article/details/52086910

 

Guess you like

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