How do I get Maven 2 to build 2 separate WAR files

后端 未结 8 2060
有刺的猬
有刺的猬 2020-12-29 15:34

When doing a mvn install I want to end up with 2 WAR files in my target directory. One will contain the production web.xml and the

8条回答
  •  不思量自难忘°
    2020-12-29 16:12

    I think this can only be achieved by writing a custom Maven plugin or interfering with the build lifecycle and running the war assembling process twice (this is just a faint idea).

    Maybe you could create two profiles and run the goal twice with different profiles (mvn -P prof1 package, mvn -P prof2 package), but be careful with the generated artifact names, they shouldn't be overwritten. Or you might be able to create a custom plugin that uses other plugins and assembles the two war files.

提交回复
热议问题