no

How to customized application context name in wildfly

As far as I know there are 3 ways to deploy an application in JBoss or Wildfly with a custom application context name. 1.) By adding jboss...

As far as I know there are 3 ways to deploy an application in JBoss or Wildfly with a custom application context name.

1.) By adding jboss-web.xml in your web project WEB-INF folder;
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
      http://www.jboss.com/xml/ns/javaee
      http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd">
   <context-root>/</context-root>
</jboss-web>

2.) Adding application.xml in your ear's META-INF folder:
<?xml version="1.0" encoding="UTF-8"?>
<application version="5" xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="
      http://java.sun.com/xml/ns/javaee
      http://java.sun.com/xml/ns/javaee/application_5.xsd">
 <module>
  <ejb>czetsuya-ejb.jar</ejb>
 </module>
 <module>
  <web>
   <web-uri>czetsuya.war</web-uri>
   <context-root>/</context-root>
  </web>
 </module>
</application>

3.) In your ear's pom.xml:
<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-ear-plugin</artifactId>
 <version>${version.ear.plugin}</version>
 <configuration>
  <!-- Tell Maven we are using Java EE 6 -->
  <version>6</version>
  <!-- Use Java EE ear libraries as needed. Java EE ear libraries are 
   in easy way to package any libraries needed in the ear, and automatically 
   have any modules (EJB-JARs and WARs) use them -->
  <defaultLibBundleDir>lib</defaultLibBundleDir>
  <modules>

   <webModule>
    <groupId>com.kbs</groupId>
    <artifactId>czetsuya-web</artifactId>
    <contextRoot>/</contextRoot>
   </webModule>

  </modules>
  <fileNameMapping>no-version</fileNameMapping>
 </configuration>
</plugin>

Related

wildfly 2242764286560052634

Post a Comment Default Comments

item