简体   繁体   English

Maven项目变更

[英]Change of Maven project

I have a project in Maven and the problem is that I cannot change the name of the whole project. 我在Maven中有一个项目,问题是我无法更改整个项目的名称。 There is pom.properties file: 有pom.properties文件:

#Generated by Maven Integration for Eclipse
#Thu Dec 19 14:38:08 CET 2013
version=1.0.0-BUILD-SNAPSHOT
groupId=org.springframework.samples
m2e.projectName=project-name
m2e.projectLocation=D\:\\Project-name
artifactId=Project-name

and I want to change the field projectName but I cannot :/ Anyone can tell me how to change the name of the project ? 并且我想更改字段projectName,但是我不能:/任何人都可以告诉我如何更改项目的名称?

您将需要对项目pom.xml文件进行修改。

You can always create a new project from scratch with the new name, recreate the folder/package structure, and copy the file contents of the old project into it. 您始终可以使用新名称从头开始创建新项目,重新创建文件夹/包结构,并将旧项目的文件内容复制到其中。 This works best if the project isn't too large. 如果项目不是太大,则效果最好。

If you have your project setup correctly, you only check-in your Maven pom file. 如果您的项目设置正确,则仅签入Maven pom文件。 You don't check-in IDE files (Eclipse, IntelliJ, etc.). 您无需签入IDE文件(Eclipse,IntelliJ等)。 In this case, the Maven names are the authoritative version. 在这种情况下,Maven名称是权威版本。 You can rename them in Maven, and if Eclipse keeps the old name, it should not be an issue. 您可以在Maven中重命名它们,并且如果Eclipse保留旧名称,那应该不是问题。

Remember, that in Maven you have two concepts for name . 记住,在Maven中, name有两个概念。 There is artifactId which is the output name and is used for dependency resolution. artifactId ,它是输出名称,用于依赖性解析。 There there is name , which is a human-readable name. name ,这是人类可读的名称。

Just change your pom file: 只需更改您的pom文件:

<artifactId>project-name</artifactId>
<name>Friendly Project Name</name>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM