是否有可能在Maven生成的application.xml中有多个上下文根?

时间:2014-05-26 20:58:01

标签: maven java-ee

Maven能够为EAR生成application.xml文件,并将上下文根目录放在EAR pom.xml中定义的文件中。 是否可以生成具有多个上下文根的application.xml

或者是唯一可能实现此目的的方法是自己编写application.xml并使用它而不是生成的那个?

2 个答案:

答案 0 :(得分:0)

当然,在Maven ear插件的目标耳中使用applicationXml选项。有关如何使用它的更多信息,请查看其usage page。 问候。

答案 1 :(得分:0)

我假设您的意思是针对您耳内的不同WAR的不同上下文根(因为每个Web模块可以只有一个上下文根)。在这种情况下,你可以明确地将你的战争模块配置在耳朵的pom中:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.9</version>
        <configuration>
           <modules>
             <webModule>
               <groupId>artifactGroupId</groupId>
               <artifactId>module1</artifactId>
               <contextRoot>/context-root-module1</contextRoot>
             </webModule>
             <webModule>
               <groupId>artifactGroupId</groupId>
               <artifactId>module2</artifactId>
               <contextRoot>/context-root-module2</contextRoot>
             </webModule>
          </modules>
        </configuration>
      </plugin>
    </plugins>
  </build>