1

I am working on multi profile project and its maven pom file hierarchy parent pom file contailn the tomcat7 plugin.

Parent pom.xml
  |--child1 pom.xml
  |--child2 pom.xml
  |--child3 pom.xml
  |--child4 pom.xml
  |--child5 pom.xml

Profiles

Parent pom.xml 
profiles
    profile1 modules
      |--child1
      |--child2
    profile2 modules
      |--child1
      |--child3
      |--child4

I am willing to have following external server.xml file

<?xml version='1.0' encoding='utf-8'?>
<Server port="8080" shutdown="SHUTDOWN">
  <Service name="Catalina">
    <Connector port="8080" protocol="HTTP/1.1" />
    <Engine name="Catalina" defaultHost="localhost">
      <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
        <Listener className="it.xxx.tomcat.listener.TBXServerLifecycleListener"/>
      </Host>
    </Engine>
  </Service>
</Server>

And i have configured server.xml file location in tomcat plugin itself

<serverXml>${user.dir}\conf\server.xml</serverXml>

Without this external config file tomcat is starting fine but after adding this tomcat plugin doesn't idetify war file in the selected profile,

Acccording to the following answer I must configure webapp paths in this file.

https://stackoverflow.com/a/26004617/1709600

But in my priject i have around 50 profiles and each profile webapps are diffetent. I cannot configure every webapp in this single server.xml file.

Then my question is ,

Is there way to and webapps path in tomcat plugin itself ???

without adding following xml tag to server.xml file server.xml

<Context docBase="../../webapp" path="/webapp" reloadable="true" />

I have already play with following configurations but any of this didn't work for me ... :(

<defaultContextFile>${user.dir}\conf\context.xml</defaultContextFile>
<warSourceDirectory>${project.build.directory}/${project.build.finalName}/</warSourceDirectory>
<warDirectory>${project.build.directory}/${project.build.finalName}/</warDirectory>
<warFile>${project.build.directory}/${project.artifactId}.war</warFile>

My Maven command :

tomcat7:run-war-only -P profileX
Tharinda Wicky
  • 388
  • 4
  • 16

0 Answers0