Diogo Moreira
Diogo Moreira

Reputation: 1082

Project name different from artifact-Id

When I import Maven projects from my workspace and these projects are children of a parent project, they're imported with project name exactly like the artifact-id. But when I import a parent project, the project name is just like the directory name.

Example of directory structure:

project-parent (artifactId = project-application-parent)
--web (artifactId = project-webapp)
--core (artifactId = project-core)

When I import all projects my workspace looks like this:

project-parent
project-webapp
project-core

What I want is to parent project be named like his artifact-id (project-application-parent). Is there a way to achieve this?

Upvotes: 5

Views: 13236

Answers (3)

yamcha85
yamcha85

Reputation: 21

The problem occurs if the project is located in the workspace. If you move the project out of the workspace, the problem no longer occurs.

Upvotes: 2

Yohji
Yohji

Reputation: 170

It is possible setting the projectNameTemplate property in the configuration of the maven-eclipse-plugin, as in Documentation.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-eclipse-plugin</artifactId>
  <version>x.y</version>
  <configuration>
    <projectNameTemplate>custom-project-name</projectNameTemplate>
  </configuration>
</plugin>

Upvotes: 4

polypiel
polypiel

Reputation: 2341

One way to rename the project is directly editing the .project file. This is a XML file located in the project folder with basic eclipse information about the project.

Just change the node (it will only affect the project name in Eclipse)

Upvotes: 2

Related Questions