Solr
  1. Solr
  2. SOLR-3042

Maven jetty plugin is misconfigured

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6, 4.0-ALPHA
    • Component/s: None
    • Labels:
      None

      Description

      The maven jetty plugin is very popular and useful because it allows you to run a web application with a trivial command line execution "mvn jetty:run" and without setting up a servlet engine or deploying your app to it. Perhaps more importantly, it allows fast debug cycles in development. The plugin is misconfigured right now and I'm told its pedigree was a copy-paste from somewhere – it was never verified to work. Attached is a patch that configures it properly. There's not much to it.

        Activity

        Hide
        Steve Rowe added a comment -

        I successfully ran mvn jetty:run with the patched version on trunk; I've committed it there.

        However, when I applied the patch to branch_3x, I get this error when I run mvn jetty:run:

        SEVERE: org.apache.solr.common.SolrException: Error loading class 'solr.VelocityResponseWriter'
                at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:389)
                at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:425)
                at org.apache.solr.core.SolrCore.createInitInstance(SolrCore.java:447)
                at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1559)
                at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1553)
                at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1586)
                at org.apache.solr.core.SolrCore.initWriters(SolrCore.java:1469)
                at org.apache.solr.core.SolrCore.<init>(SolrCore.java:556)
        

        Apparently trunk is not affected because the example solrconfig.xml says to load solr.VelocityResponseWriter lazily - branch_3x seems to also have lazy-startup-loading capabilities - I wonder why this wasn't backported?

        I was able to get things to work by setting the solr.velocity.enabled system property to false, but people shouldn't have to know that.

        When I add a dependency from the webapp module on the velocity contrib module, things just work. This means, though, that the velocity contrib will be included in the Maven-built war, unlike the Ant-built war, and I want to avoid differences like this.

        An alternative (works for me) is to add a <systemProperty> setting to the maven-jetty-plugin configuration in the webapp POM:

        <systemProperty>
          <name>solr.velocity.enabled</name>
          <value>false</value>
        </systemProperty>
        

        David, what do you think?

        Show
        Steve Rowe added a comment - I successfully ran mvn jetty:run with the patched version on trunk; I've committed it there. However, when I applied the patch to branch_3x, I get this error when I run mvn jetty:run : SEVERE: org.apache.solr.common.SolrException: Error loading class 'solr.VelocityResponseWriter' at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:389) at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:425) at org.apache.solr.core.SolrCore.createInitInstance(SolrCore.java:447) at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1559) at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1553) at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:1586) at org.apache.solr.core.SolrCore.initWriters(SolrCore.java:1469) at org.apache.solr.core.SolrCore.<init>(SolrCore.java:556) Apparently trunk is not affected because the example solrconfig.xml says to load solr.VelocityResponseWriter lazily - branch_3x seems to also have lazy-startup-loading capabilities - I wonder why this wasn't backported? I was able to get things to work by setting the solr.velocity.enabled system property to false, but people shouldn't have to know that. When I add a dependency from the webapp module on the velocity contrib module, things just work. This means, though, that the velocity contrib will be included in the Maven-built war, unlike the Ant-built war, and I want to avoid differences like this. An alternative (works for me) is to add a <systemProperty> setting to the maven-jetty-plugin configuration in the webapp POM: <systemProperty> <name> solr.velocity.enabled </name> <value> false </value> </systemProperty> David, what do you think?
        Hide
        Steve Rowe added a comment -

        Aha - the lazy-loading was added to trunk in SOLR-2718, and Erik Hatcher says on the issue that it should be backported to branch_3x, but nobody ever did that. (Mea culpa - I was the one who backported SOLR-2588 to branch_3x.) I'll look into backporting SOLR-2718 and see if that fixes the branch_3x mvn jetty:run problem.

        Show
        Steve Rowe added a comment - Aha - the lazy-loading was added to trunk in SOLR-2718 , and Erik Hatcher says on the issue that it should be backported to branch_3x, but nobody ever did that. (Mea culpa - I was the one who backported SOLR-2588 to branch_3x.) I'll look into backporting SOLR-2718 and see if that fixes the branch_3x mvn jetty:run problem.
        Hide
        Steve Rowe added a comment -

        I'll look into backporting SOLR-2718 and see if that fixes the branch_3x mvn jetty:run problem.

        Done - this does fix the branch_3x mvn jetty:run problem; I'll commit the branch_3x backport shortly.

        Show
        Steve Rowe added a comment - I'll look into backporting SOLR-2718 and see if that fixes the branch_3x mvn jetty:run problem. Done - this does fix the branch_3x mvn jetty:run problem; I'll commit the branch_3x backport shortly.
        Hide
        Steve Rowe added a comment -

        Committed to branch_3x.

        Show
        Steve Rowe added a comment - Committed to branch_3x.
        Hide
        Steve Rowe added a comment -

        Thanks David!

        Show
        Steve Rowe added a comment - Thanks David!

          People

          • Assignee:
            Steve Rowe
            Reporter:
            David Smiley
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development