How to exclude pom.xml from Maven generated war?

Using the standard Maven packaging you can't omit the file to my knowledge. It is possible however to use the maven-assembly-plugin to construct the war, in this case you have much finer grained control over the contents of the artifact, and can omit the pom.xml.

Using the standard Maven packaging you can't omit the file to my knowledge. It is possible however to use the maven-assembly-plugin to construct the war, in this case you have much finer grained control over the contents of the artifact, and can omit the pom.xml. However I have personally found it useful to keep the pom.

Xml for diagnostic purposes. It can be handy to know what was used to build and assemble the war when trying to figure out what is wrong with your app. Update: in a bizarre bit of synchronicity to Pascal's answer, I've just been reading up on the Archiver reference and it appears that this can be done by setting the addMavenDescriptor property to false.

Personally I would still avoid doing this for reasons given above. But you may want to change your acceptance to Pascal's answer.

1 Thanks Rich for your insightful comments on all Maven related questions! :-) I learned on all your answers. On this one, I was especially interested in the second paragraph, more related to best-practice and hard-learned experience.

– KLE Sep 25 '09 at 15:05 I agree with the diagnostic purpose. However, we have some special customization in pom. Xml, which reveals file structure on build machine.

Of course, we do not want to expose that information to clients or any user. I will try the maven-assembly-plugin. Thanks!

– user179080 Sep 25 '09 at 15:27 I tend to agree with Rich (I find it handy too to keep these files) but I think that the Maven Archiver provide a configuration option allowing to avoid the packaging of these files. See my answer below. – Pascal Thivent Oct 2 '09 at 17:17.

I'm not sure but I think that the Maven Archiver (which is mainly used by plugins to handle packaging) can be configured to achieve this. About the element, the Maven Archiver Reference says: Whether the generated archive will contain these two Maven files: The pom file, located in the archive in META-INF/maven/${groupId}/${artifactId}/pom. Xml A pom.

Properties file, located in the archive in META-INF/maven/${groupId}/${artifactId}/pom. Properties The default value is true. So a pom configured like this should do the trick: ... org.apache.maven.

Plugins maven-war-plugin 2.0 false ... ...

1, By coincidence I was just on my way to edit my answer having read up on the archiver a bit for this question: stackoverflow. Com/questions/1510071 – Rich Seller Oct 2 '09 at 17:23 Well, I just discovered this while digging on the archiver for the manifest question too :) If you want to update your answer, just let me know. – Pascal Thivent Oct 2 '09 at 17:38 I updated my answer and recommended the OP accept yours, then some bugger downvoted me.

Charming – Rich Seller Oct 2 '09 at 17:43 Thanks, very noble from you. And just no comment about the downvote. – Pascal Thivent Oct 2 '09 at 17:50.

Putting a META-INF folder in a resources directory or in the root of your source directory will destroy the META-INF content created by Maven. For WAR files, putting a META-INF in your web content directory will do the same. Adding other content to that custom META-INF will override what maven would create.

I put a META-INF folder in resources directory, not only maven/ directory got inserted, but also my MANIFEST. MF file got override. I am using maven-war-plugin, version 2.0.

I tried version 2.1. Beta-1, still the same. – user179080 Sep 25 '09 at 20:46.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions