为什么我使用maven jetty 热部署+jetty开发Web感觉忒不方便

maven配置jetty插件的时候webAppSourceDirectory不起作用 - ITeye问答
是有jetty插件配置web项目,配置如下:
&!-- 项目构建配置 --&
&finalName&ROOT&/finalName&
&resources&
&resource&
&directory&${basedir}/src/main/resources&/directory&
&filtering&true&/filtering&
&includes&
&include&spring/*.*&/include&
&include&mybatis/*.*&/include&
&include&template/*.*&/include&
&include&*.xml&/include&
&/includes&
&/resource&
&resource&
&directory&${basedir}/src/main/resources&/directory&
&excludes&
&exclude&spring/*.*&/exclude&
&exclude&mybatis/*.*&/exclude&
&exclude&template/*.*&/exclude&
&exclude&*.xml&/exclude&
&exclude&env/*.*&/exclude&
&/excludes&
&/resource&
&/resources&
&artifactId&maven-resources-plugin&/artifactId&
&version&2.5&/version&
&configuration&
&detail&true&/detail&
&includeEmptyDirs&true&/includeEmptyDirs&
&overwrite&true&/overwrite&
&encoding&UTF-8&/encoding&
&filter&${basedir}/src/main/resources/env/${package.environment}.properties&/filter&
&/filters&
&/configuration&
&artifactId&maven-war-plugin&/artifactId&
&version&2.2&/version&
&configuration&
&warName&ROOT&/warName&
&webXml&${basedir}/WebRoot/WEB-INF/web.xml&/webXml&
&failOnMissingWebXml&true&/failOnMissingWebXml&
&webappDirectory&${basedir}/WebRoot&/webappDirectory&
&warSourceDirectory&${basedir}/WebRoot&/warSourceDirectory&
&encoding&UTF-8&/encoding&
&/configuration&
&groupId&org.apache.maven.plugins&/groupId&
&artifactId&maven-surefire-plugin&/artifactId&
&version&2.12.1&/version&
&configuration&
&skipTests&true&/skipTests&
&testFailureIgnore&true&/testFailureIgnore&
&/configuration&
&artifactId&maven-clean-plugin&/artifactId&
&version&2.4.1&/version&
&configuration&
&filesets&
&directory&${basedir}/WebRoot/WEB-INF/lib&/directory&
&/fileset&
&directory&${basedir}/WebRoot/WEB-INF/classes&/directory&
&/fileset&
&/filesets&
&/configuration&
&groupId&org.mortbay.jetty&/groupId&
&artifactId&jetty-maven-plugin&/artifactId&
&version&8.1.2.v&/version&
&configuration&
&webAppSourceDirectory&${basedir}/WebRoot&/webAppSourceDirectory&
&contextPath&/&/contextPath&
&war&${project.build.directory}/${project.build.finalName}.war&/war&
&/configuration&
&/plugins&
但是在运行mvn jetty:run的时候,结果如下:
[INFO] webAppSourceDirectory not set. Defaulting to D:\crm\crm_jetty\src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes directory D:\crm\crm_jetty\target\classes does not exist
[INFO] Context path = /
[INFO] Tmp directory = D:\crm\crm_jetty\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =
[INFO] web.xml file = null
[INFO] Webapp directory = D:\crm\crm_jetty\src\main\webapp
21:57:19.990:INFO:oejs.Server:jetty-8.1.10.v
21:57:21.624:INFO:oejpw.PlusConfiguration:No Transaction manager foun
d - if your webapp requires one, please configure one.
21:57:27.585:INFO:/:No Spring WebApplicationInitializer types detecte
d on classpath
21:57:27.995:INFO:oejs.AbstractConnector:Started SelectChannelConnect
or@0.0.0.0:8080
[INFO] Started Jetty Server
即还是使用默认的src\main\webapp作为默认的web目录。这个问题查了很久也没有答案,maven上也有其他人问这个问题,说是版本的问题,但是我换了多个版本后还是有这个问题,求高手解决
我也遇到了同样的问题,配置的参数根本不起作用. 6.1.xx可以,8以上就不行.你现在解决了吗?能说下解决方案么.
已解决问题
未解决问题maven工程开启jetty调试 -
- ITeye技术网站
博客分类:
准备工作:
a. 在pom.xml中配置jetty插件:
&groupId&org.mortbay.jetty&/groupId&
&artifactId&maven-jetty-plugin&/artifactId&
&version&6.1.26&/version&
&configuration&
&webAppSourceDirectory&src/main/webapp&/webAppSourceDirectory&
&scanIntervalSeconds&6&/scanIntervalSeconds&
&contextPath&/prospect&/contextPath&
&webDefaultXml&jetty.xml&/webDefaultXml&
&jettyEnvXml&jetty-env.xml&/jettyEnvXml&
&connectors&
&connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"&
&port&8080&/port&
&headerBufferSize&80000&/headerBufferSize&
&/connector&
&/connectors&
&stopKey&stop&/stopKey&
&stopPort&8089&/stopPort&
&/configuration&
&/plugins&
b. 使用maven的clean install命令将web及依赖工程打包成war文件。
方式1 - Eclipse调试:
①. 右键maven工程,在弹出的菜单中选择[Debug As],首次选择[Maven build...],以后选择[Maven build]来读取保存的配置启动:
②. 在浏览器输入地址http://localhost:8080/prospect/already/mosaic.htm,在代码上加断点,命中后IDE提示:Source not found:
解决:
点击[Edit Source Lookup Path...]添加源代码工程或目录
完成后即可调试代码:
方式2 - 远程调试:
①. 选择Eclipse的[Run]-[External Tools]-[External Tools Configurations...]菜单。
在打开的对话框中,新建一个Program,输入mvn.bat (mvnDebug.bat)的完整路径,指定要启动的web工程,在Arguments框输入jetty:run
使用mvn.bat时,需要添加调试参数:
切换到Environment选项,添加一个变量:
MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1066
注:address是和调试器通信的端口,不是服务的端口号。
其它参数:
-Xnoagent: 禁用默认sun.tools.debug调试器
-piler=NONE: 禁止JIT编译器的加载
dt_shmem: 共享内存传输,仅限于Windows
点击[Run]启动jetty服务器
选择Eclipse的[Run]-[Debug Configurations...]菜单,在弹出的对话框中,新建一个Remote Java Application,指定和External Tools里面相同的工程和连接属性:
点击[Debug]启动调试客户端
②. 同方式1的②
附:
i. 远程调试的jvm可以独立于Eclipse运行:
这时Eclipse里只有调试客户端:
ii. 如果suspend=y,运行JVM而没有开启调试客户端,JVM会等待直到客户端就绪:
浏览 29010
浏览: 570559 次
来自: 杭州
引用[lis[color=indigo][/color]t][ ...
讲解的很不错,收益了。感谢发表者;
感谢整理,Java初学者受益良多
启动服务端项目: 浏览器输入:http://localhost ...shijinabsj 的BLOG
用户名:shijinabsj
文章数:21
访问量:12222
注册日期:
阅读量:5863
阅读量:12276
阅读量:380420
阅读量:1072732
[匿名]zhangzengbo198:
51CTO推荐博文
& 1、mvn archetype:create -DgroupId=org.david.app -DartifactId=mywebapp -DarchetypeArtifactId=maven-archetype-webapp&
2、cd mywebapp&
&&&& mvn eclipse:eclipse&
&&&& 导入eclipse工程&
&&&& (或者直接从eclipse中导入maven工程)&
3、添加servlet依赖&
&&&&&&& &dependency&&
&&&&& &groupId&javax.servlet&/groupId&&
&&&&& &artifactId&servlet-api&/artifactId&&
&&&&& &version&2.5&/version&&
&&& &/dependency&&
4、添加源代码目录src/main/java&
&&&& 将源代码放在该目录下。&
5、添加jetty插件&
&& &finalName&mywebapp&/finalName&&
&& &plugins&&
&&&&&&& &plugin&&
&&&&&&&&& &groupId&org.apache.maven.plugins&/groupId&&
&&&&&&&&& &artifactId&maven-compiler-plugin&/artifactId&&
&&&&&&&&& &configuration&&
&&&&&&&&&&& &source&1.5&/source&&
&&&&&&&&&&& &target&1.5&/target&&
&&&&&&&&& &/configuration&&
&&&&&&& &/plugin&&
&&&&&&& &plugin&&
&&&&&&&&& &groupId&org.mortbay.jetty&/groupId&&
&&&&&&&&& &artifactId&maven-jetty-plugin&/artifactId&&
&&&&&&& &/plugin&&&&&&&&
&& &/plugins&&
6、用jetty调试(http://www.blogjava.net/alwayscy/archive//118584.html)&
命令行:mvn jetty:run本文出自 “” 博客,请务必保留此出处
了这篇文章
类别:┆阅读(0)┆评论(0)解决maven jetty 的 OutOfMemoryError问题 -
- ITeye技术网站
用maven 的jetty 运行appfuse的时候,出现了java.lang.OutOfMemoryError:PermGen space的错误,解决的办法是调整Maven opts的jvm虚拟内存的办法,因为我用的是ubuntu 12 做开发,网上很多的解决办法都是不行的,这里推荐一种简单的办法:
首先可以运行:
export MAVEN_OPTS="-XX:+CMSClassUnloadingEnabled -XX:PermSize=256M -XX:MaxPermSize=512M"
mvn jetty:run
这是两行代码,直接在项目的目录上运行,如果通过这两行代码运行jetty后可以顺利解决内存不足的问题,那么可以把Maven opts 写在~/.bashrc上,也就是把上面的代码写入到bashrc中。
windows 系统也可以通过同样的原理解决,需要注意的是,linux 系统是用export,win系统用set来定义系统变量
具体参考:
浏览: 43855 次
来自: 广州
写的很好.. 继续加油..
我现在就是感觉基础非常的不好.. ...
zxzxvv 写道.out 里面的样式 overflow:hi ...
.out 里面的样式 overflow: 这一项 ...

我要回帖

更多关于 jetty maven plugin 9 的文章

 

随机推荐