javaspring-bootrenamemaven-archetype

Renaming Java class with Maven Archetype


Is it possible to rename a java class using Maven? I'm using the Maven Archetype to generate new projects based on my model. I can set a new groupId, artifactId, and packages for each new project.

This is the current pom.xml inside target.

<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<packaging>jar</packaging>

So, when I want to create a project Banana (artifactId) inside com.foo (groupId) , it's pretty possible. All I need to do is run: mvn archetype:generate (...arguments like groupId, artifactId, version)

It will generate a new project based on my archetype, renaming its packages, groupId, artifactId. But I also want to rename some java classes, thus:

ArchetypeApplication.java should be renamed to BananaApplication.java!

Is there some way to do that?


Solution

  • You can only specify a class name if the archetype supports this feature. For example: zk-archetype-theme defines the "theme-listener-class" property for this.