I have a project which I compile with maven. I have different profiles declared in pom.xml. For some of these profiles, I prefer building a war, and for other profiles I prefer a jar. I use to manually edit the pom.xml file and change packaging variable to either

<packaging>war</packaging>

or

<packaging>jar</packaging>

before doing a

$ mvn clean package -Pchosenprofile

How can I tell mvn the packaging corresponding to each profile so I don't need to edit pom.xml?

Edit
Report