Question

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?

Was it helpful?

Solution 2

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>

OTHER TIPS

When you import maven project, click on 'Advanced' panel on the bottom of the import dialog and there you can choose an alternative name template.

The default is [artifactId], but you can choose, for example, [name] which is the content of the description tag from pom.

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)

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top