问题
Does it make sense to do that? If yes, where can I find an example of doing that with a simple "Hello World from Web"? Do people run webapps with Jetty when they execute it from Maven? I imagine tomcat is too heavy for that.
Any help will be appreciated! Thx!
回答1:
I deploy .war files to our internal Archiva Maven repository so that I can pull them down to assembly things like RPMS without having to hand copy files around, same with building assemblies. It also is useful when the .war is something like a service that is generic and may be included in multiple other web app compliations.
That said, Central is probably NOT the place to be deploying .war files to.
回答2:
Imo, the central repository should contain libraries not applications. It's just for resolving dependencies and maven plugins.
回答3:
Central is not the right place for this, you should be deploying applications to a local respository. Nexus is fairly easy to setup and is a good place to start: http://nexus.sonatype.org/
There are other alternatives such as Artifacotry http://www.jfrog.com/products.php
Jetty is a great way to make sure things are up and running but during development Tomcat with your IDE's server plugin is just as lightweight.
回答4:
We have used it once, for a very special case though. We deploy one of our servlet as part of a third-party web application delivered as a .war file. The third-party war in this case is deployed to the central repository. We use it as dependency in our servlet project, download it during the build process, replace the existing WEB-INF/web.xml with our own customized version (that has our servlet declaration), add the servlet class to the war and ship it. Jackrabbit Standalone is an example of an web-app within Jetty. Yes, jetty is lightweight. The source code for Jettification of the standalone can be downloaded from the Jackrabbit's public repository if you want to give it a try. Its mavenized and they build it as bundle so that you can just run the web-app within jetty out of the box.
来源:https://stackoverflow.com/questions/7679143/does-it-make-sense-to-deploy-a-war-with-a-webapp-to-maven-central-repository