Renaming resources in Maven

Using the antrun-maven-plugin makes it easy, but in case you are looking for a more mavenish way which is supported within eclipse m2e, then you can use the copy-rename-maven-plugin

  <plugin>
    <groupId>com.coderplus.maven.plugins</groupId>
    <artifactId>copy-rename-maven-plugin</artifactId>
    <version>1.0.1</version>
    <executions>
      <execution>
        <id>rename-file</id>
        <phase>compile</phase>
        <goals>
          <goal>rename</goal>
        </goals>
        <configuration>
          <sourceFile>${project.build.outputDirectory}/default.DS_Store</sourceFile>
          <destinationFile>${project.build.outputDirectory}/.DS_Store</destinationFile>
        </configuration>
      </execution>
    </executions>
  </plugin>

And in case you have any feedback/issues with the plugin, you can reach out at https://github.com/coderplus/copy-rename-maven-plugin/

Leave a Comment