0

I ve got an maven based web project including the "normal" directory structure. I've the need to generate to war artifacts, one is the normal app, the other is an admin "version", which is realised by using 2 different maven-profiles. In case of the admin version I need to rename a JSP-file just before the war file is packaged.

How can I do this? Which maven-plugin fits this requirement?

Jon Lin
  • 142,182
  • 29
  • 220
  • 220
  • Take a look at [this answer](http://stackoverflow.com/questions/10133485/files-got-overwritten-in-maven-project-when-building-a-war/10144507#10144507); I believe you may adapt it to fit your needs. – user944849 Jun 19 '12 at 15:20

2 Answers2

0

IMHO you must use ant run to rename your files and attach this execution to prepare-package phase.

Olivier Lamy
  • 2,280
  • 1
  • 14
  • 12
0

sorry, but to copy/rename the JSPs during prepare-package phase doesn't work, because the files are not yet in the target directory at this point.

sample code:

    <plugin>
  <artifactId>maven-antrun-plugin</artifactId>
   <version>1.7</version>
  <executions>
    <execution>
      <phase>prepare-package</phase>
      <configuration>
        <target>
          <copy file="${project.build.directory}\myProject\loginAdmin.jsp"
            tofile="${project.build.directory}\myProject\loginUser.jsp"/>
        </target>
      </configuration>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>
  </executions>
</plugin>