简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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