简体   繁体   English

哪个Maven原型用于webapp

[英]Which Maven archetype for webapp

I am pretty new to Maven and I have the following question when I shall: 我是Maven的新手,我有以下问题:

Build a web application (Java EE 6) and use web-services. 构建Web应用程序(Java EE 6)并使用Web服务。 If I use one of the maven arcetypes I get a src/java/main & src/java/test and a web app folder. 如果我使用其中一个maven arcetypes,我会得到一个src / java / main和src / java / test以及一个web app文件夹。 This is packaged as a WAR, but can I use webservice API when the package is WAR? 这被打包为WAR,但是当包是WAR时我可以使用webservice API吗? How do you use Maven when you want to use all API's and create a web app? 当您想要使用所有API并创建Web应用程序时,如何使用Maven?

Not sure I'd I understand your question, but the archetype you use to create the project is of no importance. 我不确定我是否理解你的问题,但你用来创建项目的原型并不重要。 It is a simple way to create some of the artifacts that is needed. 这是创建一些所需工件的简单方法。 If you want to use Webservices add the appropriate dependencies (most likely scoped as 'provided' since your container will already supply the implementation. 如果您想使用Webservices添加适当的依赖项(最有可能作为'提供',因为您的容器已经提供了实现。

If you package it as a WAR you will not be able to use the full EE stack (only servlets) unless you're deploying to a EE6 compliant application server. 如果将其打包为WAR,则除非要部署到符合EE6的应用程序服务器,否则将无法使用完整的EE堆栈(仅限servlet)。 If you want to use EJBs and REsource Adapters you need to package it as an EAR (EJB supported in WAR as o EE6 as mentioned above). 如果要使用EJB和REsource Adapters,则需要将其打包为EAR(如上所述,在EE中支持EJB作为EE6)。

I think there is an archetype for a "full" EE application as well if you want more modules and packaging :) 我认为如果你想要更多的模块和包装,还有一个“完整”EE应用程序的原型:)

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM