Solr
  1. Solr
  2. SOLR-6006

Separate test and compile scope dependencies in the Solrj and Solr contrib ivy.xml files, so that the derived Maven dependencies get filled out properly in the corresponding POMs

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 4.7.2
    • Fix Version/s: 4.9, 6.0
    • Component/s: Build
    • Labels:
      None

      Description

      I'm not sure what version this first appeared in, as we just bumped from 4.5 to 4.7, but log4j is specified as a dependency in the solr-solrj pom.xml, and without the optional flag. I checked out the source to verify that there isn't actually a dependency on log4j (doesn't seem to be), but I wasn't able to decipher the ant build (looks like there's a pom.xml.template that generates the pom with dependencies coming from Ivy?)

      Anyway, this is an issue since now we have to manually <exclude> log4j from every project that depends on SolrJ.

      1. SOLR-6006.patch
        9 kB
        Steve Rowe
      2. SOLR-6006-contribs.patch
        49 kB
        Steve Rowe

        Activity

        Hide
        Steve Rowe added a comment -

        As of Lucene/Solr 4.7, the POM dependencies are built using a custom Ant task that collects compile-phase and test-phase dependencies from each module's ivy.xml file - see LUCENE-5217.

        Solrj's ivy.xml includes a compile-phase dependency on log4j, even though non-test compilation succeeds without it - it's needed only for test-phase compilation; unfortunately, there are no test-phase dependencies defined in that module, so compile- and test- phase dependencies are mixed. By contrast, modules solr-core, morphlines-core and dataimporthandler declare test dependencies, which are retrieved into per-module test-lib/ directories (as opposed to lib/ for non-test dependencies).

        The fix is to distinguish test-phase dependencies, including log4j, from compile-phase dependencies. I'll work on a patch.

        Show
        Steve Rowe added a comment - As of Lucene/Solr 4.7, the POM dependencies are built using a custom Ant task that collects compile-phase and test-phase dependencies from each module's ivy.xml file - see LUCENE-5217 . Solrj's ivy.xml includes a compile-phase dependency on log4j, even though non-test compilation succeeds without it - it's needed only for test-phase compilation; unfortunately, there are no test-phase dependencies defined in that module, so compile- and test- phase dependencies are mixed. By contrast, modules solr-core, morphlines-core and dataimporthandler declare test dependencies, which are retrieved into per-module test-lib/ directories (as opposed to lib/ for non-test dependencies). The fix is to distinguish test-phase dependencies, including log4j, from compile-phase dependencies. I'll work on a patch.
        Hide
        Steve Rowe added a comment -

        Patch, retrieves Solrj test deps to solr/solrj/test-lib/. Solr-core ivy.xml needed to changes too, since the solr-core classpath includes solr/solrj/lib/. Tests pass under Ant and, after ant get-maven-poms, under Maven.

        The only compile-phase logging dependency Solrj retains is slf4j-api - turns out Solrj doesn't need the log4j dependency, even for tests.

        I'll see if it's useful to make the same change in the Solr contribs other than dataimporthandler, which already has the test-lib/ setup.

        Show
        Steve Rowe added a comment - Patch, retrieves Solrj test deps to solr/solrj/test-lib/ . Solr-core ivy.xml needed to changes too, since the solr-core classpath includes solr/solrj/lib/ . Tests pass under Ant and, after ant get-maven-poms , under Maven. The only compile-phase logging dependency Solrj retains is slf4j-api - turns out Solrj doesn't need the log4j dependency, even for tests. I'll see if it's useful to make the same change in the Solr contribs other than dataimporthandler, which already has the test-lib/ setup.
        Hide
        ASF subversion and git services added a comment -

        Commit 1589937 from Steve Rowe in branch 'dev/trunk'
        [ https://svn.apache.org/r1589937 ]

        SOLR-6006: Separate test and compile scope dependencies in the Solrj ivy.xml file, so that the derived Maven dependencies get filled out properly in the Solrj POM

        Show
        ASF subversion and git services added a comment - Commit 1589937 from Steve Rowe in branch 'dev/trunk' [ https://svn.apache.org/r1589937 ] SOLR-6006 : Separate test and compile scope dependencies in the Solrj ivy.xml file, so that the derived Maven dependencies get filled out properly in the Solrj POM
        Hide
        ASF subversion and git services added a comment -

        Commit 1589940 from Steve Rowe in branch 'dev/trunk'
        [ https://svn.apache.org/r1589940 ]

        SOLR-6006: IntelliJ config for solrj/test-lib/

        Show
        ASF subversion and git services added a comment - Commit 1589940 from Steve Rowe in branch 'dev/trunk' [ https://svn.apache.org/r1589940 ] SOLR-6006 : IntelliJ config for solrj/test-lib/
        Hide
        Steve Rowe added a comment -

        I neglected to test the Solr contribs, and they were failing after I committed the patch on trunk because they all have a test-scope dependency on jcl-over-slf4j - Uwe's Jenkins has made its unhappiness known: http://jenkins.thetaphi.de/job/Lucene-Solr-trunk-Linux/10156/

        This patch fixes the build by giving each Solr contrib a test-lib/ if it doesn't already have it, and adding jcl-over-slf4j to its test scope dependencies.

        Committing shortly.

        Show
        Steve Rowe added a comment - I neglected to test the Solr contribs, and they were failing after I committed the patch on trunk because they all have a test-scope dependency on jcl-over-slf4j - Uwe's Jenkins has made its unhappiness known: http://jenkins.thetaphi.de/job/Lucene-Solr-trunk-Linux/10156/ This patch fixes the build by giving each Solr contrib a test-lib/ if it doesn't already have it, and adding jcl-over-slf4j to its test scope dependencies. Committing shortly.
        Hide
        ASF subversion and git services added a comment -

        Commit 1589953 from Steve Rowe in branch 'dev/trunk'
        [ https://svn.apache.org/r1589953 ]

        SOLR-6006: fix Solr contrib test dependencies by adding jcl-over-slf4j and retrieving it into each contrib's test-lib/ directory

        Show
        ASF subversion and git services added a comment - Commit 1589953 from Steve Rowe in branch 'dev/trunk' [ https://svn.apache.org/r1589953 ] SOLR-6006 : fix Solr contrib test dependencies by adding jcl-over-slf4j and retrieving it into each contrib's test-lib/ directory
        Hide
        ASF subversion and git services added a comment -

        Commit 1589959 from Steve Rowe in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1589959 ]

        SOLR-6006: Separate test and compile scope dependencies in the Solrj and Solr contrib ivy.xml files, so that the derived Maven dependencies get filled out properly in the corresponding POMs (merged trunk r1589937, r1589940, and r158953)

        Show
        ASF subversion and git services added a comment - Commit 1589959 from Steve Rowe in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1589959 ] SOLR-6006 : Separate test and compile scope dependencies in the Solrj and Solr contrib ivy.xml files, so that the derived Maven dependencies get filled out properly in the corresponding POMs (merged trunk r1589937, r1589940, and r158953)
        Hide
        Steve Rowe added a comment -

        Committed to trunk and branch_4x.

        Show
        Steve Rowe added a comment - Committed to trunk and branch_4x.
        Hide
        Steve Rowe added a comment -

        Thanks for reporting, Steven!

        Show
        Steve Rowe added a comment - Thanks for reporting, Steven!

          People

          • Assignee:
            Steve Rowe
            Reporter:
            Steven Scott
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development