Solr
  1. Solr
  2. SOLR-3431

Make dist-war-excl-slf4j target available in the Maven repository

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 4.0-ALPHA
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      Since SOLR-2487 was closed, a new build target dist-war-excl-slf4j was created for the Ant build, but this war file isn't in Maven yet.

      Users who want to build a Solr war with Maven and without slf4j included have to expand the war file and delete the WEB-INF/lib/slf4j-jdk14-1.6.4.jar file.

      With this target in Maven, expanding the war won't be necessary.

        Issue Links

          Activity

          Hide
          Neil Hooey added a comment -

          This issue needs the build target produced by the dependent issue.

          Show
          Neil Hooey added a comment - This issue needs the build target produced by the dependent issue.
          Hide
          Steve Rowe added a comment -

          Neil,

          Would a profile that excludes slf4j-jdk14.jar work for you? Then you'd build a .war using:

          mvn -P buh-bye-slf4j package
          
          Show
          Steve Rowe added a comment - Neil, Would a profile that excludes slf4j-jdk14.jar work for you? Then you'd build a .war using: mvn -P buh-bye-slf4j package
          Hide
          Neil Hooey added a comment -

          Sure, I just want to confirm that we're talking about the same thing.

          I have my own Maven project, with <packaging>war</packaging> that has solr, solr-core, and a bunch of other Solr and Lucene dependencies.

          If running something like:

          mvn -P excl-slf4j package
          

          ... would affect the my war file by excluding slf4j from the Solr dependencies, that would work for me.

          Where would you define this profile?

          Show
          Neil Hooey added a comment - Sure, I just want to confirm that we're talking about the same thing. I have my own Maven project, with <packaging>war</packaging> that has solr , solr-core , and a bunch of other Solr and Lucene dependencies. If running something like: mvn -P excl-slf4j package ... would affect the my war file by excluding slf4j from the Solr dependencies, that would work for me. Where would you define this profile?
          Hide
          Steve Rowe added a comment -

          maven-war-plugin's overlays might be what you're looking for: http://maven.apache.org/plugins/maven-war-plugin/overlays.html

          Show
          Steve Rowe added a comment - maven-war-plugin's overlays might be what you're looking for: http://maven.apache.org/plugins/maven-war-plugin/overlays.html
          Hide
          Neil Hooey added a comment -

          How do I find out with artifactId and groupId the WEB-INF/lib/slf4j-jdk14-1.6.4.jar file is coming from?

          Show
          Neil Hooey added a comment - How do I find out with artifactId and groupId the WEB-INF/lib/slf4j-jdk14-1.6.4.jar file is coming from?
          Show
          Steve Rowe added a comment - http://svn.apache.org/viewvc/lucene/dev/trunk/dev-tools/maven/solr/webapp/pom.xml.template?revision=1327600&view=markup#l65
          Hide
          Neil Hooey added a comment - - edited

          I put this in my <dependencies> section:

                  <dependency>
                      <groupId>org.slf4j</groupId>
                      <artifactId>slf4j-jdk14</artifactId>
                      <version>1.6.4</version>
                      <scope>runtime</scope>
                  </dependency>
          

          And this in my <plugins> section:

                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-war-plugin</artifactId>
                          <version>2.2</version>
                          <configuration>
                              <overlays>
                                  <overlay>
                                      <groupId>org.slf4j</groupId>
                                      <artifactId>slf4j-jdk14</artifactId>
                                      <excludes>
                                          <exclude>WEB-INF/lib/slf4j-jdk14-1.6.4.jar</exclude>
                                      </excludes>
                                  </overlay>
                              </overlays>
                          </configuration>
                      </plugin>
          

          And I get this error:

          [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project solr: overlay [ id org.slf4j:slf4j-jdk14] is not a dependency of the project. -> [Help 1]
          

          What specifically were you implying can be done to make this work?

          Show
          Neil Hooey added a comment - - edited I put this in my <dependencies> section: <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-jdk14</artifactId> <version>1.6.4</version> <scope>runtime</scope> </dependency> And this in my <plugins> section: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.2</version> <configuration> <overlays> <overlay> <groupId>org.slf4j</groupId> <artifactId>slf4j-jdk14</artifactId> <excludes> <exclude>WEB-INF/lib/slf4j-jdk14-1.6.4.jar</exclude> </excludes> </overlay> </overlays> </configuration> </plugin> And I get this error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war ( default -war) on project solr: overlay [ id org.slf4j:slf4j-jdk14] is not a dependency of the project. -> [Help 1] What specifically were you implying can be done to make this work?
          Hide
          Steve Rowe added a comment -

          Caveat: I have never done this. That said:

          • You shouldn't be adding a dependency on slf4j-jdk14.
          • Your overlay should refer to your dependency on the solr war, something like (untested!):
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.2</version>
            <configuration>
              <overlays>
                <overlay>
                  <id>exclude-slf4j-jdk14</id>
                  <groupId>org.apache.solr</groupId>
                  <artifactId>solr</artifactId>
                  <excludes>
                    <exclude>WEB-INF/lib/slf4j-jdk14-1.6.4.jar</exclude>
                  </excludes>
                </overlay>
              </overlays>
            </configuration>
          </plugin>
          
          Show
          Steve Rowe added a comment - Caveat: I have never done this. That said: You shouldn't be adding a dependency on slf4j-jdk14. Your overlay should refer to your dependency on the solr war, something like (untested!): <plugin> <groupId> org.apache.maven.plugins </groupId> <artifactId> maven-war-plugin </artifactId> <version> 2.2 </version> <configuration> <overlays> <overlay> <id> exclude-slf4j-jdk14 </id> <groupId> org.apache.solr </groupId> <artifactId> solr </artifactId> <excludes> <exclude> WEB-INF/lib/slf4j-jdk14-1.6.4.jar </exclude> </excludes> </overlay> </overlays> </configuration> </plugin>
          Hide
          Neil Hooey added a comment -

          After making those changes, it merely says this:

          [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war)
          on project solr: overlay [ id exclude-slf4j-jdk14] is not a dependency of the project. -> [Help 1]
          

          Which doesn't make much sense since that's the name of the overlay.

          Show
          Neil Hooey added a comment - After making those changes, it merely says this: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war ( default -war) on project solr: overlay [ id exclude-slf4j-jdk14] is not a dependency of the project. -> [Help 1] Which doesn't make much sense since that's the name of the overlay.
          Hide
          Steve Rowe added a comment -

          Hmm, that sucks.

          Maybe instead of overlays, try configuring maven-war-plugin <packagingExcludes>: http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.html

          Show
          Steve Rowe added a comment - Hmm, that sucks. Maybe instead of overlays, try configuring maven-war-plugin <packagingExcludes> : http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.html
          Hide
          Neil Hooey added a comment -

          That just worked!

          This is all I needed:

          <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.2</version>
            <configuration>
              <packagingExcludes>WEB-INF/lib/slf4j-jdk14-1.6.4.jar</packagingExcludes>
            </configuration>
          </plugin>
          
          Show
          Neil Hooey added a comment - That just worked! This is all I needed: <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.2</version> <configuration> <packagingExcludes>WEB-INF/lib/slf4j-jdk14-1.6.4.jar</packagingExcludes> </configuration> </plugin>
          Hide
          Jan Høydahl added a comment -

          Great. Perhaps you would like to add this instruction to our Wiki somewhere -
          http://wiki.apache.org/solr/HowToContribute#Maven or a new page?

          Show
          Jan Høydahl added a comment - Great. Perhaps you would like to add this instruction to our Wiki somewhere - http://wiki.apache.org/solr/HowToContribute#Maven or a new page?
          Hide
          Steve Rowe added a comment -

          Maybe instead of overlays, try configuring maven-war-plugin <packagingExcludes>

          That just worked!

          I'm glad you got things working.

          Show
          Steve Rowe added a comment - Maybe instead of overlays, try configuring maven-war-plugin <packagingExcludes> That just worked! I'm glad you got things working.
          Hide
          Neil Hooey added a comment - - edited

          I'll be sure to update the wiki soon, Jan.

          Thanks for your guys' help.

          Show
          Neil Hooey added a comment - - edited I'll be sure to update the wiki soon, Jan. Thanks for your guys' help.

            People

            • Assignee:
              Steve Rowe
              Reporter:
              Neil Hooey
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development