Apache Tomcat Maven Plugin
  1. Apache Tomcat Maven Plugin
  2. MTOMCAT-77

Add support for using the test classpath instead of the compile classpath with tomcat:run

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 2.0-beta-1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Maven

      Description

      For an instant developer experience, we need to be able to do something like the following:

       svn co https://company.repository.com/project/foo foo
       cd foo
       mvn install
       mvn tomcat:run
      

      Using the tomcat:run goal in itself works perfectly, but the (in-memory) database is empty. Using the Jetty plugin, I can choose to use the test classpath (which tells Hibernate to initialize the database):

      <plugin>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>maven-jetty-plugin</artifactId>
          <version>6.1.26</version>
          <configuration>
              <useTestClasspath>true</useTestClasspath>
              <webAppConfig>
                  <jettyEnvXmlFile>/src/test/config/jetty-env.xml</jettyEnvXmlFile>
              </webAppConfig>
          </configuration>
          <!-- Cut out: dependencies for the database -->
      </plugin>
      

      I want to do something similar with the Tomcat plugin:

      <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>tomcat-maven-plugin</artifactId>
          <version>1.1</version>
          <configuration>
              <useTestClasspath>true</useTestClasspath><!-- This is the requested item. -->
              <path>/</path>
              <contextFile>src/test/config/tomcat-context.xml</contextFile>
          </configuration>
          <!-- Cut out: dependencies for the database -->
      </plugin>
      

      So my request is: add a "useTestClasspath" configuration setting for tje class RunMojo that tells it to use MavenProject.getTestClasspathElements() instead of MavenProject.getCompileClasspathElements() when creating the webapp loader. On 2011-02-08, this was line 132 in the class org.codehaus.mojo.tomcat.RunMojo.

        Activity

        Hide
        Hudson added a comment -

        Integrated in TomcatMavenPlugin #53 (See https://builds.apache.org/job/TomcatMavenPlugin/53/)
        MTOMCAT-77 Add support for using the test classpath instead of the compile classpath with tomcat:run.

        olamy : http://svn.apache.org/viewvc/?view=rev&rev=1187230
        Files :

        • /tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/ClassLoaderEntriesCalculatorRequest.java
        • /tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
        • /tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunMojo.java
        • /tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/RunMojo.java
        Show
        Hudson added a comment - Integrated in TomcatMavenPlugin #53 (See https://builds.apache.org/job/TomcatMavenPlugin/53/ ) MTOMCAT-77 Add support for using the test classpath instead of the compile classpath with tomcat:run. olamy : http://svn.apache.org/viewvc/?view=rev&rev=1187230 Files : /tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/ClassLoaderEntriesCalculatorRequest.java /tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java /tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunMojo.java /tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/RunMojo.java

          People

          • Assignee:
            Olivier Lamy (*$^¨%`£)
            Reporter:
            Oscar Westra van Holthe - Kind
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development