0

我有一个基于 Maven 的 Web 项目,包括“正常”目录结构。我需要生成战争工件,一个是普通应用程序,另一个是管理员“版本”,它是通过使用 2 个不同的 maven-profiles 实现的。如果是管理员版本,我需要在打包 war 文件之前重命名 JSP 文件。

我怎样才能做到这一点?哪个 maven-plugin 符合这个要求?

4

2 回答 2

0

恕我直言,您必须使用 ant run 重命名文件并将此执行附加到准备包阶段。

于 2012-06-18T15:01:08.890 回答
0

抱歉,但是在准备包阶段复制/重命名 JSP 不起作用,因为此时文件尚未在目标目录中。

示例代码:

    <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>
于 2012-06-19T08:55:57.743 回答