jsp文件在jsp api mavenn中怎么调试

42411人阅读
maven(11)
一、在eclipse中设置maven的setting文件位置,指向你下载的maven目录中,仓库会自动生成。
一、在eclipse中创建maven工程,注意几项:
& &选择Artifact ID为maven-archetype-webapp的一项
二、创建目录结构:工程右键:new-Source Folder,创建如下几个目录
& & & &1、src/main/java
& & & &2、src/test/java
& & & &3、src/test/resources
三、依次设置java,resources目录的class输出目录,工程右键:build path-Source,双击Source Folder,在弹出框中选择输出的目录。
同时要选上Allow output folders for source folders.
四、&把项目转成Dynamic Web项目
& & & &右键项目,选择Project Facets,点击Convert to faceted from
&&配置Project Facets
选择java且版本1.6,勾选Dynamic Web Module的Version为2.5。(3.0为Java7的)。
如果提示错误,可能需要在Java Compiler设置Compiler compliance level 为1.6。或者需要在此窗口的Java的Version改成1.6。
& & & & &另:如果报错 cannot ….. Dynamic Web Module to 2.5
& & & &打开项目根目录下的.setting文件夹下的org.mon.project.facet.core.xml文件手动修改版本
& &&&faceted-project&
& &fixed facet=&wst.jsdt.web&/&
& &installed facet=&java& version=&1.6&/&&编译器1.6版,运行的JDK版本不能低于编译的版本&
& &installed facet=&jst.web& version=&2.5&/&&servlet2.5版&
& &installed facet=&wst.jsdt.web& version=&1.0&/&
& & &/faceted-project&
------------------------------------------------以下4行可忽略
配置 Modify Faceted Project
点击Further configuration available…,弹出Modify Faceted Project窗口
此处是设置web.xml文件的路径,我们输入src/main/webapp。
Generate web.xml deployment descriptor自动生成web.xml文件,可选可不选。
--------------------------------------------------------------
五、设置项目部署时文件发布的目录位置
& & & 在右键项目打开此窗口。在左侧列表中会出现一个Deployment Assembly,点击进去后,如下图:
& & 1,需要删除test的两项,因为test是测试使用,并不需要部署。
& & 2,设置将Maven的jar包发布到lib下。
& & & & &Add -& Java Build Path Entries -& Maven Dependencies -& Finish
& & 设置完成后的效果图
六、向maven项目添加jar包
& &&6.1 在pom.xml中添加所需要的jar包
& & 使用Maven POM editor打开项目中的pom.xml文件,选择Dependencies,在Dependencies栏目点击Add进行,首先弹出一个搜索按钮,例如输入spring-web,就会自动搜索关于spring-web相关的jar包,我们选择3.0.5版本的spring。将spring包全部添加进来。需要添加的其他jar包有:junit、jstl。或者点击pom.xml直接编辑pom.xml文件。这样可以直接copy过来dependencies内容。
6.2设置jar包的scope
当添加进入一个jar包后,有一些属性需要设置,最重要的就是scope,它有以下几种取值:
1. compile,缺省值,适用于所有阶段,会随着项目一起发布。
2. provided,类似compile,期望JDK、容器或使用者会提供这个依赖。如servlet.jar。
3. runtime,只在运行时使用,如JDBC驱动,适用运行和测试阶段。
4. test,只在测试时使用,用于编译和运行测试代码。不会随项目发布。
5. system,类似provided,需要显式提供包含依赖的jar,Maven不会在 Repository中查找它。
通常SpringMVC项目所需要配置scope的jar包如下图:
有的时候发现servlet-api还是被打包到lib下面了,此时肯定会报错。就需要把maven插件中的WTP也安装一下。
Eclipse在线安装路径:http://m2eclipse.sonatype.org/sites/m2e-extras。选择for Eclipse WTP。
-------------------------------------------------------------------------------------------------以下搭建spring框架部分可忽略
七、构建SpringMVC框架
7.1 编辑web.xml文件
需要添加log4j,字符过滤,Spring 的dispatcher等。
webx.xml代码如下:
&?xml version=&1.0& encoding=&UTF-8&?&
&web-app xmlns=&/xml/ns/javaee&
xmlns:xsi=&http://www.w3.org/2001/XMLSchema-instance&
xsi:schemaLocation=&/xml/ns/javaee
/xml/ns/javaee/web-app_2_5.xsd&
version=&2.5& &
&context-param&
&param-name&&/param-name&
&param-value&&/param-value&
&/context-param&
&!-- Spring的log4j监听器 --&
&listener&
&listener-class&org.springframework.web.util.Log4jConfigListener&/listener-class&
&/listener&
&!-- 字符集 过滤器
&filter-name&CharacterEncodingFilter&/filter-name&
&filter-class&org.springframework.web.filter.CharacterEncodingFilter&/filter-class&
&init-param&
&param-name&encoding&/param-name&
&param-value&UTF-8&/param-value&
&/init-param&
&init-param&
&param-name&forceEncoding&/param-name&
&param-value&true&/param-value&
&/init-param&
&filter-mapping&
&filter-name&CharacterEncodingFilter&/filter-name&
&url-pattern&/*&/url-pattern&
&/filter-mapping&
&!-- Spring view分发器 --&
&servlet-name&dispatcher&/servlet-name&
&servlet-class&org.springframework.web.servlet.DispatcherServlet&/servlet-class&
&init-param&
&param-name&contextConfigLocation&/param-name&
&param-value&/WEB-INF/dispatcher-servlet.xml&/param-value&
&/init-param&
&load-on-startup&1&/load-on-startup&
&/servlet&
&servlet-mapping&
&servlet-name&dispatcher&/servlet-name&
&url-pattern&*.do&/url-pattern&
&/servlet-mapping&
&/web-app&
7.2 编写Spring配置文件dispatcher-servlet.xml
如要添加MVC驱动、注解检测、视图解析等。dispatcher-servlet.xml代码如下:
&?xml version=&1.0& encoding=&UTF-8&?&
&beans xmlns=&http://www.springframework.org/schema/beans&
xmlns:aop=&http://www.springframework.org/schema/aop&
xmlns:context=&http://www.springframework.org/schema/context&
xmlns:mvc=&http://www.springframework.org/schema/mvc&
xmlns:tx=&http://www.springframework.org/schema/tx&
xmlns:xsi=&http://www.w3.org/2001/XMLSchema-instance&
xsi:schemaLocation=&http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd&&
&mvc:annotation-driven /&
&context:component-scan base-package=&com.xujj& /&
&bean class=&org.springframework.web.servlet.view.InternalResourceViewResolver&&
&property name=&prefix& value=&/WEB-INF/views/& /&
&property name=&suffix& value=&.jsp& /&
-------------------------------------------------------------------------------------------------以上为可忽略部分
八、maven整合tomcat,支持热部署
1、在tomcat中的conf的tomcat_users.xml中创建管理用户和密码,一般选manager-script,在pom.xml中的tomcat插件中用text,否则可能出现403错误
&tomcat-users&&
&role rolename=&manager-script&/&
&user username=&admin& password=&password& roles=&manager-script&/&
&/tomcat-users&
tomcat role changed:
Note that for Tomcat 7 onwards, the roles required to use the manager application were changed from the single manager role to the following four roles. You will need to assign the role(s) required for the functionality you wish to access.
manager-gui - allows access to the HTML GUI and the status pages
manager-script - allows access to the text interface and the status pages
manager-jmx - allows access to the JMX proxy and the status pages
manager-status - allows access to the status pages only
只用manager-gui role即可。
2、启动tomcat,然后访问&,输入admin/password,如果tomcat默认界面,表示tomcat一切OK,然后才可以继续后面操作。
3、在项目根据目录中的pom.xml文件中的build中配置tomcat插件
&groupId&org.codehaus.mojo&/groupId&
&artifactId&tomcat-maven-plugin&/artifactId&
&version&1.1&/version&
&configuration&
&url&http://localhost:8080/manager/text&/url&
2、deploy:eg http://localhost:8080/manager/deploy?path=/phoenix&war=&update=true
but the deploy url does not find.
the warning is as follows:
The page you tried to access (/manager/deploy) does not exist.
The Manager application has been re-structured for Tomcat 7 onwards and some of URLs have changed. All URLs used to access the Manager application should now start with one of the following options:
/manager/html for the HTML GUI
/manager/text for the text interface
/manager/jmxproxy for the JMX proxy
/manager/status for the status pages
&username&admin&/username&
&password&admin&/password&
&path&/baseinfo&/path&
&/configuration&
&/plugins&
1、执行tomcat:deploy时出现以下错误,是由于tomcat-users中配置的用户名或者密码与pom.xml中的不一致
Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project webs: Cannot invoke Tomcat manager: Server returned HTTP response code: 401 for URL: http://localhost:8080/manager/text/deploy?path=%2Fwebs&war= -& [Help 1]
重启tomcat,再次执行命令
2、必须启动tomcat后再执行tomcat:deploy或者tomcat:redeploy,否则报连接被拒绝的错误信息
Cannot invoke Tomcat manager: Connection refused: connect
3、403错误是因为tomcat的角色设置问题,修改角色名即可
再打开tomcat的webapps目录,已经将项目部署到该文件夹中,浏览器打开页面测试成功。
记录配置中涉及到的相关插件和知识:
1、有提到使用maven-war-plugin插件来生成war,但不使用该插件在tomcat中同样生成了项目的war包,
& && &plugin&
&groupId&org.apache.maven.plugins&/groupId&
&artifactId&maven-war-plugin&/artifactId&
&version&2.1.1&/version&
&configuration&&
&packagingExcludes&WEB-INF/web.xml&/packagingExcludes&&
&/configuration&
2、第一个项目在pom.xml中配置了以下节点,不知是否可省略
&repositories&
&repository&
&id&people.apache.snapshots&/id&
&url&http://repository.apache.org/content/groups/snapshots-group/&/url&
&releases&
&enabled&false&/enabled&
&/releases&
&snapshots&
&enabled&true&/enabled&
&/snapshots&
&/repository&
&/repositories&
&pluginRepositories&
&pluginRepository& &
& &&id&apache.snapshots&/id& &
& &&name&Apache Snapshots&/name& &
& &&url& &
& & & &http://repository.apache.org/content/groups/snapshots-group/ &
& &&/url& &
& &&releases& &
& & & &&enabled&false&/enabled& &
& &&/releases& &
& &&snapshots& &
& & & &&enabled&true&/enabled& &
& &&/snapshots& &
&/pluginRepository&
&/pluginRepositories&
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:280914次
积分:2215
积分:2215
排名:第17810名
原创:11篇
转载:62篇
评论:19条
(2)(1)(1)(19)(51)
(window.slotbydup = window.slotbydup || []).push({
id: '4740881',
container: s,
size: '200,200',
display: 'inlay-fix'温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
&3、进入工作空间选择对话框;如下图。Location-&browse选择一个文件夹作为你的项目工作空间,也就是新建项目的磁盘存储位置。然后点击next按钮,进入下一步。&4、 进入maven项目类型选择对话框,如下图。我们选择Artifact Id为maven-arrchetype-webapp。这种类型的就是maven的web项目了。点击next进入下一步。&
5、进入项目属性设置对话框,如下图。填写Group& Id和Artifact Id。其中Artifact Id将作为项目名称显示。点击finish完成项目新建过程。&6、得到一个如下目录结构的maven WEB工程项目。&7、 新建maven WEB项目的web.xml里面是没有指定欢迎页面的,需要手动加一下。加后的配置如下。&-----------------------------------------------------------------------------------------------------------
&!DOCTYPE web-app PUBLIC
&"-//Sun Microsystems, Inc.//DTD Web Application
&"/dtd/web-app_2_3.dtd"
& &display-name&Archetype Created Web Application&/display-name&
& &welcome-file-list&
&&& &&welcome-file&index.jsp&/welcome-file&
& &/welcome-file-list&
&/web-app&&-----------------------------------------------------------------------------------------------------------二、eclipse中配置调试服务容器1、打开servers视图。Window -& Show View -& Other&2、进入视图选择对话框,如下图。选择Server-&Servers 点击OK确定&3、servers视图就被加载到控制台的位置,如下图&4、在servers视图,鼠标右单击,出现如下图新建server浮动标签。点击Server。&5、进入容器选择及配置对话框,如下图。我们选择Apache-&Tomcate& v6.0 Server,点击next按钮&6、进入项目添加、移除对话框,如下图。显示在这里的项目都是WEB项目,如果在新建maven项目的时候没有选择为webapp项目,在该对话框中就不会出现如下图的mavenWeb可选项目&7、选中需要添加到容器中的web项目,点击Add,添加到server中。点击finish完成服务配置&8、完成server配置后,会在servers视图出现一个刚刚新加的server,如下图&9、这时候server配置基本完了,但是如果这时候选择服务启动,服务启动不成功启动不成功,控制台会出现如下警告。我们再加一步配置便可去除这个警告。------------------------------------------------------------------------警告:
[SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property
'source' to 'org.eclipse.jst.j2ee.server:mavenWeb' did not find a matching
property.------------------------------------------------------------------------10、双击刚刚新加的那个服务&11、进入服务配置界面,如下图。选中:Publish module contexts to separate XML files,在停止服务的情况下保存配置。不停止服务,无法保存修改的。重新启动服务,便不会出现上面的警告了&12、在浏览器里面输入地址:&&便可看到首页里面的内容了。自此,eclipse中maven web项目tomcat调试环境配置已经完成&三、原理说明
其实在eclipse中配置server的时候,eclipse会把web项目自动发布到工作空间的:
.metadata\.plugins\org.eclipse.wst.server.core\
的这个目录中,具体你的项目被发布到这个目录的哪个位置要看你配置的server个数了。假如你的eclipse中只配置了一个server,那么你的项目就被发布到:
.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
你会看到,在这个目录下有你的项目被发布到这里来了。在eclipse中运行server的时候,其实执行的文件就是这个地方的。&
阅读(2871)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
在LOFTER的更多文章
loftPermalink:'',
id:'fks_',
blogTitle:'Eclipse中Maven WEB工程tomcat调试',
blogAbstract:'最近没事了玩一下maven,使用maven',
blogTag:'tomcat,eclipse,maven',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:2,
publishTime:1,
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}博客分类:
1....maven能做些什么?.. 2 1.1 概念... 2 1.2 依赖管理... 2 1.3 生成项目骨架... 2 1.4 自动化测试... 3 1.5 持续集成构建... 3 2.... 环境配置.. 3 2.1 嵌入式运行tomcat. 3 2.2 外部运行tomcat. 3 2.3 Nexus创建私服... 4 3.... 参考资料.. 5 3.1 注意事项... 5 3.2 Maven常用命令... 5 3.3 Tomcat- Maven-Plugin常用命令... 6 3.4 Maven-POM设置: 7 3.5 Maven-Settings设置: 7 maven能做些什么? 1.1 概念 Maven是基于项目对象模型(POM),可以通过一小段描述信息来管理项目的编译,测试,打包,清理,部署等构建任务,以及生成测试报告和javadoc文档的软件项目管理工具。。 1.2 依赖管理 简单说就是统一管理jar包(也叫artifact:构件)以及之间的关系,包括版本定义和切换,构件的下载,管理构件依赖和调解构件冲突等。 1.3 生成项目骨架 已经有很多组织开发了特定于某种类型的项目骨架,可以用来创建特定类型的项目原型。比如:创建基于seam框架的项目原型。 archetype? 是一个内建插件,他的create任务将建立项目骨架 可用项目骨架有: * maven-archetype-archetype * maven-archetype-j2ee-simple * maven-archetype-mojo * maven-archetype-portlet * maven-archetype-profiles (currently under development) * maven-archetype-quickstart * maven-archetype-simple (currently under development) * maven-archetype-site * maven-archetype-site-simple, and * maven-archetype-webapp 1.4 自动化测试 使用surefire插件来进行自动化测试,支持Junit和TestNG测试框架 1.5 持续集成构建 于持续集成(continuous integeration)配合服务器,可以进行持续的构建和测试项目,还可以监视一些定期执行的任务, 生成JUnit/TestNG测试报告。常用的ci服务器有:Eclipse 基金会的顶级项目Hudson和Bamboo等。 2 环境配置 1) 、考虑到兼容问题,eclipse选择galileo(3.5.0),tomcat6.0.18,jdk 1.6.0_17,maven3.0.4. 2) 、给eclipse集成maven:m2eclipse的安装,在eclipse的Help菜单中点击Install New Software, 输入: http://m2eclipse.sonatype.org/sites/m2e,然后按提示安装. 3) 、修改eclipse的eclipse.ini文件,便于maven使用,否则启动eclipse时会提醒异常,添加(注意是两行,不用写到一行去): -vm C:/Java/jdk1.6.0_17/bin/javaw.exe 2.1 嵌入式运行tomcat 1) 、在pom.xml中添加: &plugin& &groupId&org.codehaus.mojo&/groupId& &artifactId&tomcat-maven-plugin&/artifactId& &version&1.1&/version& &configuration&&path&/&/path& &port&9090&/port& &uriEncoding&UTF-8&/uriEncoding& &/configuration& &/plugin& 2)、新建一个MavenBuild条目:在Goals中填写: tomcat:run deploy --DskipTests,意思是让maven驱动tomcat-maven-plugin插件以启动tomcat,然以不进行测试就部署项目到tomcat上. 2.2 外部运行tomcat 1) 、首先到apache-tomcat-6.0.18\conf在其中增加一个admin用户,密码是password,角色是管理员: &tomcat-users& &user username="admin" password="password" roles="manager"/& &/tomcat-users& 2)、 启动tomcat,然后访问 http://localhost:8080/manager/html,输入admin/password,如果出现以下界面表示tomcat一切OK. 3)、 在maven的setting.xml中定义本机的tomcat,增加如下内容(记住这里的id,等会要用到): &servers& &server& &id&tomcat&/id& &username&admin&/username&&password&password&/password& &/server& &/servers& 4)、 在Eclipse中建立一个打包类型为war的maven项目:demo,并修改pom.xml文件 格式如下: &project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"& &modelVersion&4.0.0&/modelVersion& &groupId&com.world&/groupId& &artifactId&demo&/artifactId& &version&0.0.1-SNAPSHOT&/version& &packaging&war&/packaging& &build& &plugins& &plugin& &groupId&org.codehaus.mojo&/groupId& &artifactId&tomcat-maven-plugin&/artifactId& &version&1.0-beta-1&/version& &configuration& &url&http://localhost:8080/manager/html&/url& &server&tomcat&/server& &/configuration& &/plugin& &/plugins& &/build& &/project& //&url&标签指明tomcat的管理器地址,&server&标签指明使用的是那个服务器。 5)、 在项目中增加web.xml和一个测试文件HotDeplyTest.jsp。 HotDeplyTest.jsp内容随便写。 6)、 Demo项目,鼠标右键,Run As 选择 Maven build,在Goals中写maven命令:package tomcat:redeploy ,意思是打包,同时部署到tomcat上。 7、 点击Run按钮,注意看Console,看看有没有错误,没有错误的话,访问: http://localhost:8080/demo/HotDeployTest.jsp, ,如果出现界面,则表示一切万事大吉. 2.3 Nexus创建私服 1)、下载Nexus :http://nexus.sonatype.org/downloads/。 Nexus 是典型的java Web应用,有两种安装包,一种是包含jetty容器的Bundle包,另一种是不包含web容器的war包。 Nexus-webapp/:目录包含了Nexus 运行所需要的文件、如启动脚本、依赖jar包 Sonatype-work/:该目录包含Nexus生成的配置文件、日志文件、仓库文件。 在window操作系统,用户需要进入nexus-webpp/bin/jsw/windows-x86-32/子目录,然后直接运行nexus.bat 启动Nexus. 2)、打开http://localhost:8081/nexus/ 就能看到Nexus 的界面。默认的登录用户是admin/admin123。 3)、创建仓库 仓库分四种类型:group(仓库组)、hosted(宿主)、proxy(代理)、virtual(虚拟)。 Maven 可以直接从宿主仓库下载构件,maven也可以从代理仓库下载构件,而代理仓库会间接从远程仓库下载并缓存构件。在Repositories 界面创建对应的仓库后在sonatype-work 目录下会生产一个对应的路径。比如在宿主仓库下创建一个id 为010的仓库D:/nexus1.9/sonatype-work/nexus/storage/010。 Nexus 三个重要的代理仓库,有中央仓库,Apache 快照仓库,和Codehaus 快照仓库。这三个仓库维护了成千上万的构建,全部下载到本地不切实际,所以大部分都维护了一个编录整个内容的Lucene 索引,以便提供快速和有效的搜索。 a、Apache Snapshots:这个仓库包含了来自于Apache软件基金会的快照版本。http://people.apache.org/repo/m2-snapshot-repository b、Codehaus Snapshots:这个仓库包含了来自于Codehaus的快照版本。 http://snapshots.repository.codehaus.org/ c、Central Maven Repository :这是中央Maven仓库(发布版本)。 http://repo1.maven.org/maven2/ 4)、上传构件,在创建好的仓库中有Artifat ?Upload 选项卡。上传构件的方式有两种,第一种是maven构件的,那么可以在GAV Definition 下拉列表中选择From POM ,否则就选GAV Parameters。用户需要为该构件定义一个Maven 坐标。Group,artifact,version。 5)、Nexus 权限管理 组织中使用Nexus 有一些安全性的需要,比如只有管理员才能配置nexus,某些团队成员才能部署构件,Nexus 根据需求提供了全面的权限控制特性,能让用户自由的根据需求配置Nexus用户、角色、权限。 3 参考资料 3.1 注意事项 防止MAVEN/OutOfMemoryError,需要在maven build-&jre中配置:-Xms128m -Xmx512m 关于Setting的说明: 一般我们复制一个setting.xml 文件到~/.m2/目录下,~表示用户目录,在我的文档中。settting.xml用于配置一些全局性的东西,比如仓库,镜像等. 关于仓库的说明: 仓库可以分为两大类,本地仓库和远程仓库。当maven根据坐标寻找构件的时候,首先在本地仓库查找,如果本地仓库存在则直接使用,如果本地仓库不存在,或者查看是否有更新的版本,maven 则回去远程仓库查看,发现以后下载到本地仓库使用,如果都没有则会报错。私服是一种特殊的远程仓库。 关于坐标的说明: Groupid:定义maven 项目隶属的实际项目。比如springFramework Artifactid:定义实际项目中的一个模块。比如spring-core,spring-context Version:版本号。2.0.0 Packageing:打包方式,.jar,.war。 Classifier:该元素用来帮组定义构件输出的一些附属构件。 其中groupid,artifactid,version 是必须定义的,packaging 是可选的,默认为jar. 3.2 Maven常用命令   mvn archetype:create 创建Maven项目   mvn eclipse:eclipse 生成eclipse项目文件   mvn compile 编译源代码   mvn test-compile 编译测试源代码   mvn test 运行应用程序中的单元测试   mvn site 生成项目相关信息的网站   mvn clean 清除项目目录中的生成结果   mvn package 根据项目生成的jar   mvn install 在本地Respository中安装jar mvn deploy 将包发布到服务器或远程仓库 3.3 Tomcat- Maven-Plugin常用命令 Goals available for this plugin: Goal Description tomcat:deploy Deploy a WAR to Tomcat. tomcat:deploy-only Deploy a WAR to Tomcat witjout forking the package lifecycle tomcat:exploded Deploy an exploded WAR to Tomcat. tomcat:help Display help information on tomcat-maven-plugin. Call mvn tomcat:help -Ddetail=true -Dgoal=&goal-name& to display parameter details. tomcat:info Lists information about the Tomcat version, OS, and JVM properties. tomcat:inplace Deploy a WAR in-place to Tomcat. tomcat:list Lists all the currently deployed web applications in Tomcat. tomcat:redeploy Redeploy a WAR in Tomcat. Deploy with forcing update flag to true tomcat:reload Reload a WAR in Tomcat. tomcat:resources Lists JNDI resources in Tomcat. tomcat:roles Lists security roles in Tomcat. tomcat:run Runs the current project as a dynamic web application using an embedded Tomcat server. tomcat:run-war Runs the current project as a packaged web application using an embedded Tomcat server. tomcat:run-war-only Runs the current project as a packaged web application using an embedded Tomcat server without forking the package cycle. tomcat:sessions Lists session information for a WAR in Tomcat. tomcat:shutdown Shuts down all possibly started embedded tomcat servers. This will be automatically down through a shutdown hook or you may call this Mojo to shut them down explictly. By default the shutdown goal is not bound to any phase. For integration tests you might want to bind it to post-integration-test. tomcat:start Start a WAR in Tomcat. tomcat:stop Stop a WAR in Tomcat. tomcat:undeploy Undeploy a WAR from Tomcat. 3.4 Maven-POM设置: http://maven.apache.org/ref/3.0.4/maven-model/maven.html 3.5 Maven-Settings设置: http://maven.apache.org/ref/3.0.4/maven-settings/settings.html
浏览: 15124 次
来自: 郑州
哥们,转载的不能贴个原帖的地址吗?}

我要回帖

更多关于 maven项目中jsp报错 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信