请问多模块的maven项目打包如何在jetty上运行啊

、先来配置一个外部工具,来运行:
选择菜单在左边选择,再点:
配置为完整命令行。定位到下的
选择为本项目。
Arguments填写:
再点选页:加入变量,值为:
-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8080,server=y,suspend=y
其中,如果表示不调试,直接运行。为端口
然后,点,点击启动
、调试应用
点选run-&debug...
选中左树中的Remote Java Application,再点New。
选择你的项目,关键是要填和之前设置外部工具时相同的端口号,其它都不变。
浏览: 29375 次
来自: 武汉
谢谢 能不能把
此文相关的代码发至邮箱
mapeijie8 ...
如Calendar,Date等类型则需要用户自己实现Conve ...
讲的挺好,不过我有些问题想问一下:
1 如果一个XML中对应有 ...
在web项目中测试servlet比较麻烦,像servletRe ...
(window.slotbydup=window.slotbydup || []).push({
id: '4773203',
container: s,
size: '200,200',
display: 'inlay-fix'个回答最终结果应该如下所示:
&groupId&org.mortbay.jetty&/groupId&
&artifactId&jetty-maven-plugin&/artifactId&
&version&7.4.4.v&/version&
&configuration&
&scanIntervalSeconds&5&/scanIntervalSeconds&
&connectors&
&connector implementation=&org.eclipse.jetty.server.nio.SelectChannelConnector&&
&port&80&/port&
&/connector&
&/connectors&
&/configuration&
&dependencies&
&dependency&
&groupId&ch.qos.logback&/groupId&
&artifactId&logback-classic&/artifactId&
&version&0.9.29&/version&
&/dependency&
&/dependencies&
&/plugin&Logback:&plugin&
&groupId&org.codehaus.mojo&/groupId&
&artifactId&properties-maven-plugin&/artifactId&
&version&1.0-alpha-2&/version&
&executions&
&execution&
&goal&set-system-properties&/goal&
&configuration&
&properties&
&!-- makes jetty log the exception if it fails to initialize slf4j --&
&property&
&name&org.eclipse.jetty.util.log.IGNORED&/name&
&value&true&/value&
&/property&
&!-- Location of logback config --&
&property&
&name&logback.configurationFile&/name&
&value&/path/to/logback.xml&/value&
&/property&
&/properties&
&/configuration&
&/execution&
&/executions&
&/plugin&Log4j:&plugin&
&groupId&org.codehaus.mojo&/groupId&
&artifactId&properties-maven-plugin&/artifactId&
&version&1.0-alpha-2&/version&
&executions&
&execution&
&goal&set-system-properties&/goal&
&configuration&
&properties&
&!-- makes jetty log the exception if it fails to initialize slf4j --&
&property&
&name&org.eclipse.jetty.util.log.IGNORED&/name&
&value&true&/value&
&/property&
&!-- this tells where the log4j configuration is --&
&property&
&name&log4j.configuration&/name&
&value&file:./src/main/resources/log4j.properties&/value&
&/property&
&!-- this can be uncommented to debug startup log4j itself,
e.g. how it locates log4j.properties etc --&
&property&
&name&log4j.debug&/name&
&value&&/value&
&/property&
&/properties&
&/configuration&
&/execution&
&/executions&
&/plugin&另外,对于log4j,可以自然地对jetty-maven-plugin使用以下依赖项,而不是Logback-经典:&plugin&
&groupId&org.mortbay.jetty&/groupId&
&artifactId&jetty-maven-plugin&/artifactId&
&dependencies&
&dependency&
&groupId&org.slf4j&/groupId&
&artifactId&slf4j-log4j12&/artifactId&
&version&1.6.4&/version&
&/dependency&
&/dependencies&
&/plugin&扫描二维码扫描关注云+社区idea使用maven项目如何运行【java吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:723,414贴子:
idea使用maven项目如何运行收藏
小弟不管用tomcat还是maven的jetty插件运行都提示有错误是哪里有不对的地方吗……
51CTO学院12年行业品牌,1600万用户选择,中国专业IT技能学习平台,java.java资深大牛授课,0基础从入门到精通,java报名与培训中心.
这是jetty插件run命令的错误栈:[ERROR] Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.3.6.v:run (default-cli) on project web-start: Execution default-cli of goal org.eclipse.jetty:jetty-maven-plugin:9.3.6.v:run failed: A required class was missing while executing org.eclipse.jetty:jetty-maven-plugin:9.3.6.v:run: javax/servlet/http/HttpServletResponse[ERROR] -----------------------------------------------------[ERROR] realm =
plugin&org.eclipse.jetty:jetty-maven-plugin:9.3.6.v[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy[ERROR] urls[0] = file:/D:/Downloads/maven_repository/org/eclipse/jetty/jetty-maven-plugin/9.3.6.v/jetty-maven-plugin-9.3.6.v.jar[ERROR] urls[1] = file:/D:/Downloads/maven_repository/org/sonatype/sisu/sisu-inject-bean/2.1.1/sisu-inject-bean-2.1.1.jar引起的原因貌似是这个[ERROR] For more information about the errors and possible solutions, please read the following articles:[ERROR] [Help 1]
这是用tomcat运行时候的错误Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: error in opening zip fileat org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:96)at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)... 48 moreCaused by: java.util.zip.ZipException: error in opening zip fileat java.util.zip.ZipFile.open(Native Method)at java.util.zip.ZipFile.&init&(ZipFile.java:219)at java.util.zip.ZipFile.&init&(ZipFile.java:149)at java.util.jar.JarFile.&init&(JarFile.java:166)at java.util.jar.JarFile.&init&(JarFile.java:103)at org.apache.catalina.webresources.JarResourceSet.initInternal(JarResourceSet.java:88)... 49 more还有一些异常我感觉应该是这几个引起的,贴多了大家肯定也不看
平时都是用Eclipse的,基本没啥问题,一切到idea就这么多问题,我一下子方了
还是我的运行方式的问题,要先compile,然后在jetty:run吗
登录百度帐号温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
“我来~我见~我征服!”
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
如果项目的名称是mvn_mvc,那么整个目录结构就如上图。 通常我们首先用mvn package生成上述的target目录中带红色部分。其等效执行 mvn compile test-compile test war:exploded war:war。也就是包含编译、测试和打包三步骤。接下来我们就可以使用mvn jetty:run或者mvn tomcat:run进行网站启动,测试运行了。此时会对应生成临时的jsp目录,jetty对应的目录名是work,tomcat对应的目录名是tomcat。那么,项目对应的目录就是target/mvn_mvc目录吗?非也非也!!!真正的项目目录应该是:本项目的java类来自于target/classes本项目依赖的jar包来自于maven的pom配置(并没有实际的物理目录,为maven插件动态组织管理)本项目依赖的配置文件和静态资源来自于src/main/webapp综上所述,可以得到两个结论就是:运行时,其实和target/mvn_mvc这个目录(打包项目目录)没有任何关系。所以如果运行过程中如果修改了这个目录的动态class和静态文件,就看不到效果。必须改src/main/java和src/main/webapp的才行。另外,maven设计的项目思想是:src目录下是纯本项目的代码,没有任何临时文件和依赖jar包。这样也便于代码的管理:自己写的是自己的,别人的机器的都放到别处如果程序调试出现异常,就按照此方法检查。譬如,再经过再一次的去maven大爷的痛苦经历后,终于明白了以前碰到的一个问题:在调试过程中,发现弹出这么一个框,标题是obsolete methods on the stack。现象就是:更新的代码在调试中不起作用。最后找到原因:不知道什么时候,在src/main/webapp/WEB_INF中出现了classes和lib目录。这会导致始终以这个目录的classes为源代码;和调试的我们的真正源代码java不一致。删掉它们才解决。
阅读(7912)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
在LOFTER的更多文章
loftPermalink:'',
id:'fks_',
blogTitle:'Maven+Spring+MVC结构中,jetty/tomcat是如何启动项目的',
blogAbstract:'针对maven配置的Spring+MVC项目,我们用Maven自带的jetty和tomcat插件进行调试,这很方便。但是调试时,这些插件所启动的web服务器,是如何来将我们的工程作为一个web项目启动并运行,可能并没有看上去那么简单。搞清楚它们启动时,是如何引用我们的项目,就是这的目的。 如果项目的名称是mvn_mvc,那么整个目录结构就如上图。 通常我们首先用mvn package生成上述的target目录中带红色部分。其等效执行 mvn compile',
blogTag:'maven,spring,mvc,jetty,tomcat:run',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:7,
publishTime:6,
permalink:'blog/static/',
commentCount:0,
mainCommentCount:0,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'
“我来~我见~我征服!” ',
hmcon:'1',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}maven 第十八课 -- 使用maven创建web项目,及打包发布,使用插件发布到jetty和tomcat
我的图书馆
maven 第十八课 -- 使用maven创建web项目,及打包发布,使用插件发布到jetty和tomcat
第一步:创建web项目&&&第二步:项目创建好了以后,添加servlet和jsp的依赖.&&第三步:创建servlet文件 首先创建一个source folder.在创建package,最后创建HelloServlet文件.&&第二步:将当前文件打包.从图中可以看到,我们已经将程序打包成一个war包.这个war包的名字叫maven-web-ch01.&&有的时候我们不想叫这么长的一个名字,有没有办法改变呢?这里需要配置打war包的插件,在插件中设置war的名称:&&第三步:war包打好了,怎么发布呢?我们知道,发布应该是发布到tomcat上的,对不对?那么,接下来我就把war拷贝过去不就可以了么.这是正常的打包发布.但这样似乎太麻烦了,每次修改了任何内容都要重新打包发布,拷贝到服务器上运行,有没有好的办法,简化这个过程呢?答案是有的,使用插件.有两种插件,一种是jetty,另一种是tomcat的.tomcat的比较复杂,我们先来学习一下使用jetty打包发布.第四步:使用jetty插件,发布项目到jetty服务器上.参考http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html如何配置jetty插件在maven上.&&下面看看我们的配置:&&运行jetty:run启动jetty服务&&在浏览器中输入:http://localhost:8080/test/HelloServlet查看运行效果.&&如何简单的在jetty中发布项目我们就学完了.接下来还要学习如何在tomcat中发布项目
喜欢该文的人也喜欢

我要回帖

更多关于 maven多项目依赖 的文章

 

随机推荐