赞
踩
我使用具有以下配置的jetty-maven-plugin:
org.eclipse.jetty
jetty-maven-plugin
9.4.1.v20170120
${basedir}/src/main/webapp/WEB-INF/development.jetty-config.xml
/
manual
0
/
mysql
mysql-connector-java
${mysql.version}
文件development.jetty-config.xml具有以下内容:
./src/main/webapp
/
./src/main/webapp
jdbc/proj1
jdbc:mysql://localhost/mydb
root
***
true
UTF-8
然后,我使用Maven命令启动Jetty:
mvn jetty:run
相关插件日志:
[INFO] <<< jetty-maven-plugin:9.4.1.v20170120:run (default-cli) < test-compile @ proj1-admin <<<
[INFO]
[INFO] --- jetty-maven-plugin:9.4.1.v20170120:run (default-cli) @ proj1-admin ---
2017-02-22 11:41:42.311:INFO::main: Logging initialized @3350ms to org.eclipse.jetty.util.log.StdErrLog
[INFO] Configuring Jetty for project: Proj Admin
[INFO] webAppSourceDirectory not set. Trying src/main/webapp
[INFO] Reload Mechanic: manual
[INFO] Classes = /home/igor/projects/Proj1/admin/target/classes
[INFO] Configuring Jetty from xml configuration file = /home/igor/projects/proj1/admin/src/main/webapp/WEB-INF/development.jetty-config.xml
[INFO] Context path = /
[INFO] Tmp directory = /home/igor/projects/proj1/admin/target/tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
[INFO] web.xml file = file:///home/igor/projects/proj1/admin/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = /home/igor/projects/proj1/admin/src/main/webapp
2017-02-22 11:41:42.449:INFO:oejs.Server:main: jetty-9.4.1.v20170120
2017-02-22 11:41:44.694:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=1975ms
2017-02-22 11:41:44.904:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
2017-02-22 11:41:44.904:INFO:oejs.session:main: No SessionScavenger set, using defaults
2017-02-22 11:41:44.907:INFO:oejs.session:main: Scavenging every 600000ms
然后打印此警告:
2017-02-22 11:41:47.150:INFO:oejsh.ContextHandler:main: Started o.e.j.m.p.JettyWebAppContext@26e412ef{/,file:///home/igor/projects/proj1/admin/src/main/webapp/,AVAILABLE}{file:///home/igor/projects/proj1/admin/src/main/webapp/}
2017-02-22 11:41:47.154:WARN:oejw.WebInfConfiguration:main: Can't generate resourceBase as part of webapp tmp dir name: java.lang.IllegalStateException: No resourceBase or war set for context
2017-02-22 11:41:47.155:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.m.p.JettyWebAppContext@4ae263bf{/,null,null}
java.lang.IllegalStateException: No resourceBase or war set for context
at org.eclipse.jetty.webapp.WebInfConfiguration.unpack(WebInfConfiguration.java:406)
at org.eclipse.jetty.maven.plugin.MavenWebInfConfiguration.unpack(MavenWebInfConfiguration.java:135)
at org.eclipse.jetty.webapp.WebInfConfiguration.preConfigure(WebInfConfiguration.java:72)
at org.eclipse.jetty.maven.plugin.MavenWebInfConfiguration.preConfigure(MavenWebInfConfiguration.java:95)
at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:501)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:539)
at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:432)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:161)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
at org.eclipse.jetty.server.Server.start(Server.java:452)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.server.Server.doStart(Server.java:419)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:460)
at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:328)
at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute(JettyRunMojo.java:170)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
令我惊讶的是,该应用程序已正确加载并正常工作。 另外,配置文件中的三行:
./src/main/webapp
/
./src/main/webapp
即使删除它们也没有任何效果。
我看了看文档,以及以下答案,但无法弄清楚:
我的问题是:
如何正确配置此插件以摆脱警告?
因为这不是错误并且应用程序正在运行,我应该真的担心吗?
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。