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

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.2
    • None
    • tomcat6, tomcat7
    • 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

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

            Dates

              Created:
              Updated: