Uploaded image for project: 'Apache Tomcat Maven Plugin'
  1. Apache Tomcat Maven Plugin
  2. MTOMCAT-269

Context file of additional web apps is ignored

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2
    • Fix Version/s: None
    • Component/s: tomcat6, tomcat7
    • Labels:
      None

      Description

      While the default context file (/META-INF/context.xml) is respected for the project itself, it is ignored for the additional web apps.

      org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java line 1425
              for ( AbstractWebapp additionalWebapp : getAdditionalWebapps() )
              {
                  String contextPath = additionalWebapp.getContextPath();
                  if ( !contextPath.startsWith( "/" ) )
                  {
                      contextPath = "/" + contextPath;
                  }
                  addContextFromArtifact( container, contexts, getArtifact( additionalWebapp ), contextPath,
                                          additionalWebapp.getContextFile(), additionalWebapp.isAsWebapp() );
              }
      

      Proposed fix:

      org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java Proposed fix
              for ( AbstractWebapp additionalWebapp : getAdditionalWebapps() )
              {
                  String contextPath = additionalWebapp.getContextPath();
                  if ( !contextPath.startsWith( "/" ) )
                  {
                      contextPath = "/" + contextPath;
                  }
                  String contextFile = null;
                  if(additionalWebapp.getContextFile() != null)
                  {
                      contextFile = additionalWebapp.getContextFile();
                  }
                  else
                  {
                      File defaultConfigFile = new File( configurationDir, "webapps/"+artifact.getArtifactId()+"/META-INF/context.xml" );
                      if(defaultConfigFile.exists())
                      {
                          contextFile = defaultConfigFile.getAbsolutePath();
                      }
                  }
                  addContextFromArtifact( container, contexts, getArtifact( additionalWebapp ), contextPath,
                                          contextFile, additionalWebapp.isAsWebapp() );
              }
      

      These might be a similar problem with tomcat6-maven-plugin

        Attachments

          Activity

            People

            • Assignee:
              olamy Olivier Lamy
              Reporter:
              skopf.alfresco Stefan Kopf
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: