设为首页 收藏本站
查看: 522|回复: 0

[经验分享] jetty-maven-plugin配置大全

[复制链接]

尚未签到

发表于 2017-2-26 09:46:10 | 显示全部楼层 |阅读模式
jetty-maven-plugin配置大全:
 
测试环境:JDK1.6,jetty-distribution-8.1.8.v20121106,Maven2.2
更多请参考http://wiki.eclipse.org/Jetty
  http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html

<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.10.v20130312</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<!-- configure the container                 -->
<!--add a jetty.xml file to webapp A. and then add WebAppContexts for the other 2 webapps:
<jettyXml>src/main/etc/jetty.xml</jettyXml>
<Ref id="Contexts">
<Call name="addHandler">
<Arg>
<New class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/B</Set>
<Set name="war">../../B.war</Set>
</New>
</Arg>
</Call>
<Call>
<Arg>
<New class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/C</Set>
<Set name="war">../../C.war</Set>
</New>
</Arg>
</Call>
</Ref>
-->
<contextHandlers>           
<contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
<war>${basedir}../../B.war</war>
<contextPath>/B</contextPath>
</contextHandler>
<contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
<war>${basedir}../../C.war</war>
<contextPath>/B</contextPath>
</contextHandler>
</contextHandlers>
<stopPort>9966</stopPort>
<stopKey>foo</stopKey>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>7777</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<useProvidedScope>true</useProvidedScope>
<systemPropertiesFile>${basedir}/mysys.props</systemPropertiesFile>
<systemProperties>
<systemProperty>
<name>fooprop</name>
<value>222</value>
</systemProperty>
<systemProperty>
<name>org.apache.commons.logging.Log</name>
<value>org.apache.commons.logging.impl.Log4JLogger</value>
</systemProperty>
<systemProperty>
<name>slf4j</name>
<value>false</value>
</systemProperty>
<systemProperty>
<name>log4j.configuration</name>
<value>file:/${jetty.home}/resources/log4j.properties</value>
</systemProperty>
</systemProperties>
<war>${basedir}/target/myfunkywebapp</war>
<!--
<contextXml> Optional The path to a context xml file that is applied to your webapp AFTER the <webApp> element.
-->
<webApp>
<contextPath>/test</contextPath>
<!--
<contextPath> The context path for your webapp. By default, this is set to the /${project.artifactId} from the project's pom.xml.
<descriptor> The path to the web.xml file for your webapp.
<defaultsDescriptor> The path to a webdefault.xml file that will be applied to your webapp before the web.xml. If none is supplied, Jetty uses a default one baked into the jetty-webapp.jar.
<overrideDescriptor> The path to a web.xml file that will be applied after your web.xml is read. You can use this to replace or add configuration.
<tempDirectory> The path to a dir that Jetty can use to expand or copy jars and jsp compiles when your webapp is running. The default is ${project.build.outputDirectory}/tmp
<baseResource> the path from which Jetty will serve static resources. Defaults to src/main/webapp.
<resourceBases> use instead of <baseResource> if you have multiple dirs from which you want to serve static content. This is an array of dir names.
<baseAppFirst> Optional. Defaults to "true". Controls whether any overlayed wars are added before or after the original base resource(s) of the webapp.
<jettyEnvXml> Optional. Location of a jetty-env.xml file, which allows you to make JNDI bindings that satisfies <env-entry>, <resource-env-ref> and <resource-ref> linkages in the web.xml. Note that these can also be made in a <jettyXml> file if you want them to apply to more than one webapp.
<containerIncludeJarPattern>. Since jetty-8.1.x. Optional. A pattern to match against the urls of the jars on the container path to select those that should be examined for things like META-INF fragments, resources, tlds and class inheritance hierarchy (used with servlet container initializers).
<webInfIncludeJarPattern>. Since jetty-8.1.6. Optional. A pattern to match against the urls of the jars considered to be on the webapp's WEB-INF classpath to select those that should be examined for META-INF fragments, resources, tlds, and class inheritance hierarchy (used with servlet container initializers). The default is to potentially examine them all, subject to any ordering exclusions configured in web.xml.
<classesDirectory> – Location of your compiled classes for the webapp. You should rarely need to set this parameter. Instead, you should set <build><outputDirectory> in your pom.xml.
<testClassesDirectory> – Location of the compiled test classes for your webapp. By default this is ${project.build.testOutputDirectory}.
<useTestScope> – If true, the classes from <testClassesDirectory> and dependencies of scope "test" are placed first on the classpath. By default this is false.
<useProvidedScope> - If true, the dependencies with scope "provided" are placed onto the container classpath. Note: NOT the webapp classpath, as "provided" indicates that these dependencies would normally be expected to be provided by the container. You should very rarely ever need to use this. Instead, you should copy the provided dependencies as explicit dependencies of the <plugin> instead.
<webAppSourceDirectory> – By default, this is set to ${basedir}/src/main/webapp. If your static sources are in a different location, set this parameter accordingly.
<scanTargets> –Optional A list of files and directories to periodically scan in addition to those automatically scanned by the plugin.
<scanTargetPatterns> –Optional If you have a long list of extra files you want scanned, it is more convenient to use pattern matching expressions to specify them instead of enumerating them with the <scanTargets>–List of <scanTargetPattern>s, each consisting of a <directory,> and <including> and/or <excluding> parameters to specify the file matching patterns.
<skip> - Optional Default is false. If true, the execution of the plugin will exit. Same as setting the SystemProperty -Djetty.skip on the command line.
-->
</webApp>
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>Test Realm</name>
<config>${basedir}/src/etc/realm.properties</config>
</loginService>
</loginServices>
<!--
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>java:/jaas/company-sso</name>
<config>${jetty.home}/etc/company/system/company-realm.properties</config>
</loginService>
</loginServices>
-->
</configuration>
</plugin>
 

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-347298-1-1.html 上篇帖子: Jetty 类加载器体系结构【转】 下篇帖子: jetty源码架构分析
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表