2 Replies Latest reply on Jan 23, 2013 1:22 AM by nickarls

    How to exclude hibernate jar files in package with maven.

    samwun9988

      Hi,

      With Jboss 7.1.1.Final and Hibernate-search 4.2.0, I tried to add the excluded clause to the pom.xml file but I found the hibernate-search-4.2.0.jar file still present in my package list.

       

      Here is the my pom.xml file where I tried to exculde the jar file:

       

       

      <plugin>

                      <groupId>org.hibernate</groupId>

                      <artifactId>hibernate-search</artifactId>

                      <version>4.2.0.Final</version>

                      <configuration>

                         <modules>

                           <javaModule>

                             <groupId>org.hibernate</groupId>

                             <artifactId>hibernate-search</artifactId>

                             <version>4.2.0.Final</version>

                             <excluded>true</excluded>

                           </javaModule>

                        </modules>

                      </configuration>

                    </plugin>

       

      The hibernate jar files are still in the package:

       

       

      jar tf ForestSurf-ear-1.0.ear

      META-INF/

      META-INF/MANIFEST.MF

      lib/

      ForestSurf-ejb-1.0.jar

      ForestSurf-web-1.0.war

      lib/antlr-2.7.7.jar

      lib/aopalliance-1.0.jar

      lib/avro-1.6.3.jar

      lib/commons-codec-1.6.jar

      lib/commons-io-2.1.jar

      lib/commons-lang-2.6.jar

      lib/commons-logging-1.1.1.jar

      lib/dom4j-1.6.1.jar

      lib/guava-r05.jar

      lib/hibernate-commons-annotations-4.0.1.Final.jar

      lib/hibernate-core-4.1.9.Final.jar

      lib/hibernate-jpa-2.0-api-1.0.1.Final.jar

      lib/hibernate-search-4.2.0.Final.jar

      lib/hibernate-search-analyzers-4.2.0.Final.jar

      lib/hibernate-search-engine-4.2.0.Final.jar

      lib/hibernate-search-orm-4.2.0.Final.jar

       

      Any suggestion is very much appreciated.

      Thanks

      Sam

        • 1. Re: How to exclude hibernate jar files in package with maven.
          samwun9988

          I used provided scope in the pom.xml file and "copy" in the execution clause, but during compile time, it flagged as error one of the jar file is not found.

           

          Here is my pom.xml file:

           

           

          <?xml version="1.0" encoding="UTF-8"?>

          <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

              <modelVersion>4.0.0</modelVersion>

              <parent>

              <artifactId>ForestSurf</artifactId>

              <groupId>ForestSurf</groupId>

              <version>1.0</version>

            </parent>

           

           

              <groupId>ForestSurf</groupId>

              <artifactId>ForestSurf-ejb</artifactId>

              <version>1.0</version>

              <packaging>ejb</packaging>

           

           

              <name>ForestSurf-ejb</name>

           

           

              <properties>

                  <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>

                  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

                  <log4j.version>1.2.14</log4j.version>

                  <hibernate.version>4.1.7.Final</hibernate.version>

                  <org.springframework-version>3.0.7.RELEASE</org.springframework-version>

              </properties>

           

           

              <dependencies>

                  <dependency>

                      <groupId>org.hibernate</groupId>

                      <artifactId>hibernate-core</artifactId>

                      <version>4.1.9.Final</version>

                      <scope>provided</scope>

                  </dependency>

                  <dependency>

                      <groupId>org.hibernate</groupId>

                      <artifactId>hibernate-annotations</artifactId>

                      <version>3.5.6-Final</version>

                      <scope>provided</scope>

                  </dependency>

                  <dependency>

                          <groupId>org.hibernate</groupId>

                          <artifactId>hibernate-infinispan</artifactId>

                          <version>4.1.9.Final</version>

                          <scope>provided</scope>

                  </dependency>

                  <dependency>

                      <groupId>org.hibernate</groupId>

                      <artifactId>hibernate-search</artifactId>

                      <version>4.2.0.Final</version>

                      <scope>provided</scope>

                     

                  </dependency>

                  <dependency>

                      <groupId>org.springframework</groupId>

                      <artifactId>spring-orm</artifactId>

                      <version>3.2.0.RELEASE</version>

                  </dependency>

                  <dependency>

                      <groupId>javax</groupId>

                      <artifactId>javaee-api</artifactId>

                      <version>6.0</version>

                      <scope>provided</scope>

                  </dependency>

           

           

                  <dependency>

                      <groupId>org.hibernate</groupId>

                      <artifactId>hibernate-envers</artifactId>

                      <version>4.1.9.Final</version>

                      <scope>provided</scope>

           

           

                      <exclusions>

                          <exclusion>

                              <groupId>dom4j</groupId>

                              <artifactId>dom4j</artifactId>

                          </exclusion>

                      </exclusions>

                  </dependency>

                 

                  <dependency>

                      <groupId>org.hibernate</groupId>

                      <artifactId>hibernate-entitymanager</artifactId>

                      <version>4.1.9.Final</version>

                      <scope>provided</scope>

                      <type>jar</type>

                  </dependency>

                 

                  <dependency>

                          <groupId>org.apache.lucene</groupId>

                          <artifactId>lucene-snowball</artifactId>

                          <version>3.0.3</version>

                  </dependency>

                  <dependency>

                      <groupId>org.apache.lucene</groupId>

                      <artifactId>lucene-core</artifactId>

                      <version>4.0.0</version>

                  </dependency>

                  <dependency>

                          <groupId>org.apache.lucene</groupId>

                          <artifactId>lucene-analyzers-common</artifactId>

                          <version>4.0.0</version>

                  </dependency>

          <!--        <dependency>

                          <groupId>org.hibernate</groupId>

                          <artifactId>hibernate-search-engine</artifactId>

                          <version>4.1.1.Final</version>

                  </dependency>-->

                  <dependency>

                      <groupId>commons-lang</groupId>

                      <artifactId>commons-lang</artifactId>

                      <version>2.6</version>

                  </dependency>

                  <dependency>

                      <groupId>joda-time</groupId>

                      <artifactId>joda-time</artifactId>

                      <version>2.1</version>

                  </dependency>

                  <dependency>

                      <groupId>org.slf4j</groupId>

                      <artifactId>slf4j-log4j12</artifactId>

                      <version>1.7.2</version>

                      <type>jar</type>

                  </dependency>

                  <dependency>

                      <groupId>junit</groupId>

                      <artifactId>junit</artifactId>

                      <version>4.8.1</version>

                      <scope>test</scope>

                  </dependency>

              </dependencies>

           

           

              <build>

                  <plugins>

                      <plugin>

                          <groupId>org.apache.maven.plugins</groupId>

                          <artifactId>maven-compiler-plugin</artifactId>

                          <version>2.3.2</version>

                          <configuration>

                              <source>1.6</source>

                              <target>1.6</target>

                              <compilerArguments>

                                  <endorseddirs>${endorsed.dir}</endorseddirs>

                              </compilerArguments>

                          </configuration>

                      </plugin>

                      <plugin>

                          <groupId>org.apache.maven.plugins</groupId>

                          <artifactId>maven-ejb-plugin</artifactId>

                          <version>2.3</version>

                          <configuration>

                              <ejbVersion>3.1</ejbVersion>

                          </configuration>

                      </plugin>

                      <plugin>

                          <groupId>org.apache.maven.plugins</groupId>

                          <artifactId>maven-dependency-plugin</artifactId>

                          <version>2.1</version>

                          <executions>

                              <execution>

                                  <phase>validate</phase>

                                  <goals>

                                      <goal>copy</goal>

                                  </goals>

                                  <configuration>

                                      <outputDirectory>${endorsed.dir}</outputDirectory>

                                      <silent>true</silent>

                                      <artifactItems>

                                          <artifactItem>

                                              <groupId>javax</groupId>

                                              <artifactId>javaee-endorsed-api</artifactId>

                                              <version>6.0</version>

                                              <type>jar</type>

                                          </artifactItem>

                                          <artifactItem>

                                              <groupId>org.hibernate</groupId>

                                              <artifactId>hibernate-search</artifactId>

                                              <version>4.2.0.Final</version>

                                              <type>jar</type>

                                          </artifactItem>

                                      </artifactItems>

                                  </configuration>

                              </execution>

                             

                          </executions>

                      </plugin>

                  </plugins>

              </build>

           

           

          </project>

           

           

          Thanks

          Sam

          • 2. Re: How to exclude hibernate jar files in package with maven.
            nickarls

            See other thread (and try to keep the discussion concentrated to a single thread/per issue)