开发者

How to change URI of WAR file in EAR file in MyEclipse?

开发者 https://www.devze.com 2023-01-14 19:41 出处:网络
We have following projects: office - web application project console - web application project MyEclipse by default deploys these web applications to following locations:

We have following projects:

office - web application project

console - web application project

MyEclipse by default deploys these web applications to following locations:

C:\tools\jboss-5.1.0.GA\server\web\deploy\office.war  
C:\tools\jboss-5.1.0.GA\server\web\deploy\console.war  

But in ant build and in our deployment scripts we use different names for war files:

devoffice.war  
devconsole.war  

Now we are going not only build these two war files but we are going to create enterprise applic开发者_开发百科ation devapp that will include both of these web applications:

devapp - enterprise application project

In EAR we describe web applications in META-INF\application.xml

I created following application.xml:

<application >
  <display-name>devapp</display-name>
  <module>
    <web>
      <web-uri>devoffice.war</web-uri>
      <context-root>/office</context-root>
    </web>
  </module>
  <module>
    <web>
      <web-uri>devconsole.war</web-uri>
      <context-root>/console</context-root>
    </web>
  </module>
</application>

This application.xml works in case if we build EAR and WAR files by ant build procedure.

But this application.xml cannot be used from Eclipse because by default Eclipse creates office.war and console.war files but not devoffice.war and devconsole.war.

Is it possible to change the name of module in enterprise application?


In the EAR project in eclipse, go to Properties / Deployment Assembly. You can edit the Deploy path for the WAR projects to any WAR file name.


I'm not sure how you would change the names of the projects as part of the build without the help of a build tool like ant or maven.

If you were using Maven, you could use the bundleFileName element of the Maven ear plugin's configuration to set an explicit name for the wars in the build of the ear, described here http://maven.apache.org/plugins/maven-ear-plugin/howto.html

It seems like an unusual thing to want to do, so just in case you are actually interested in changing the webapp context roots, you can set that in the ear file itself as described here http://docs.jboss.org/jbossas/guides/webguide/r2/en/html/ch06.html

0

精彩评论

暂无评论...
验证码 换一张
取 消