Why isn't my war file containing all of the contents?

时间:2015-06-30 19:26:10

标签: java eclipse maven war

I have a web application. I have created a war file out of the "export" option from Eclipse. However, the war file only contains the META-INF and the WEB-INF folders. There are no .java or .class files at all.

I also tried another method using the Maven "clean install" goals. This one also gives me the exact problem as above. Where am I going wrong? Can someone help me out?

Thanks.

2 个答案:

答案 0 :(得分:0)

如果你的代码在maven的默认src路径中,请chcek(src \ main \ java)

答案 1 :(得分:0)

如果您的项目是Eclipse项目,则需要确保将其创建为动态Web项目'所以Eclipse附加了正确的Facets,因此它知道如何构建.war。

如果它是一个maven项目,那么至少要包括

<packaging>war</packaging>

所以Maven知道如何打包你的应用程序。

如果你运行了mvn package&#39;,假设你的pom.xml配置正确,你应该得到一个在目标目录中创建的.war文件。

听起来没有正确配置 - 您可以分享有关源项目结构及其配置方式的更多信息吗?