eclipsemavenm2e

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?


Solution

  • 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>