myeclipse之不能部署问题(Undefined exploded archive location)

参考资料 
1 ECLIPSE中部署工程报“Undefined exploded archive location”错误的解决方法 
http://blog.csdn.net/jojoy_828/article/details/2050728 
2 Undefined exploded archive location 错误  
http://ljhzzyx.blog.163.com/blog/static/38380312201010923129855/ 
http://www.blogjava.net/hulizhong/archive/2008/06/20/209502.html 
原因:在工程转移过程中,导致工程的配置文件出错 
部署错误情况一 
1 在myeclipse配置的server中不能部署工程,报错如下: 
no projects are  available for deployment to this server Either the all have already been deployed to this server or no deployable projects have been found 
报错图片如下: 
 
说明一下,我的工程类型为J2EE1.3,编译语法为1.4,检查工程的相关文件,其中的.project文件内容如下 
Xml代码   收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <projectDescription>  
  3.     <name>XXXX</name>  
  4.     <comment></comment>  
  5.     <projects>  
  6.     </projects>  
  7.     <buildSpec>  
  8.         <buildCommand>  
  9.             <name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>  
  10.             <arguments>  
  11.             </arguments>  
  12.         </buildCommand>  
  13.         <buildCommand>  
  14.             <name>org.eclipse.jdt.core.javabuilder</name>  
  15.             <arguments>  
  16.             </arguments>  
  17.         </buildCommand>  
  18.         <buildCommand>  
  19.             <name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>  
  20.             <arguments>  
  21.             </arguments>  
  22.         </buildCommand>  
  23.         <buildCommand>  
  24.             <name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>  
  25.             <arguments>  
  26.             </arguments>  
  27.         </buildCommand>  
  28.         <buildCommand>  
  29.             <name>org.eclipse.wst.validation.validationbuilder</name>  
  30.             <arguments>  
  31.             </arguments>  
  32.         </buildCommand>  
  33.         <buildCommand>  
  34.             <name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>  
  35.             <arguments>  
  36.             </arguments>  
  37.         </buildCommand>  
  38.     </buildSpec>  
  39.     <natures>  
  40.         <nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>  
  41.         <nature>org.eclipse.jdt.core.javanature</nature>  
  42.     </natures>  
  43. </projectDescription>  

你也许会问,如何查看这个.project文件呢,有二种方法,一种是在物理磁盘上你的工程下面 
第二种是在Eclipse中,如下图所示 
点击Package Explorer右边的下拉小三角 
 
点击Filters... 
 
把框中第一个复选框勾选取消(.resources) 
 
3 点击确定后就可在工程中查看到.project文件了  
你可根据工程的使用的版本,创建相应的工程,将其中的.project文件内容拷贝过去, 
如下,我创建的是J2EE1.3的版本,粘贴至相应的位置,内容如下: 
Xml代码   收藏代码
  1. <buildSpec>  
  2.         <buildCommand>  
  3.             <name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>  
  4.             <arguments>  
  5.             </arguments>  
  6.         </buildCommand>  
  7.         <buildCommand>  
  8.             <name>org.eclipse.jdt.core.javabuilder</name>  
  9.             <arguments>  
  10.             </arguments>  
  11.         </buildCommand>  
  12.         <buildCommand>  
  13.             <name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>  
  14.             <arguments>  
  15.             </arguments>  
  16.         </buildCommand>  
  17.         <buildCommand>  
  18.             <name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>  
  19.             <arguments>  
  20.             </arguments>  
  21.         </buildCommand>  
  22.         <buildCommand>  
  23.             <name>org.eclipse.wst.validation.validationbuilder</name>  
  24.             <arguments>  
  25.             </arguments>  
  26.         </buildCommand>  
  27.         <buildCommand>  
  28.             <name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>  
  29.             <arguments>  
  30.             </arguments>  
  31.         </buildCommand>  
  32.     </buildSpec>  
  33.     <natures>  
  34.         <nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>  
  35.         <nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>  
  36.         <nature>org.eclipse.jdt.core.javanature</nature>  
  37.     </natures>  

这样就可解决这个问题了  
部署错误情况二 
接上面的情况继续部署工程,发现不能把工程发布到服务器中,报错如下: 
Undefined exploded archive location 
仔细对应二个工程属性文件上,从SVN上checkout出来的项目中没有.mymetadata文件, 
可能webrootdir被改无效了或者少了这context-root这个属性,如上操作,将.mymetadata文件拷贝到工程中,修改相应的工程名称,请注意一点的是.WebRoot的名字是否正确
,内容如下: 
Xml代码   收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <project-module  
  3.   type="WEB"  
  4.   name="XXXX"  
  5.   id="myeclipse.1202968712015"  
  6.   context-root="/XXXX"  
  7.   j2ee-spec="1.3"  
  8.   archive="XXXX.war">  
  9.   <attributes>  
  10.     <attribute name="webrootdir" value="WebRoot" />  
  11.   </attributes>  
  12. </project-module>  

注意事项:在myeclipse中创建的可能不是WebRoot这个名字,可能是:WebContent 
那么请修改.mymetadata文件中webrootdir对应的value
.如下: 
Xml代码   收藏代码
  1. <attribute name="webrootdir" value="WebContent" />  

最后关掉Eclipse,再启动Eclipse,接着发布工程,发布成功!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值