0

I referred so many links. I finally got this And I don't prefer this way

I want to exclude slf4j from this jar. It is glassfish embedded all.

Why do I want to Exclude?

It is a different story. If I include this slf4j, then AKKA event logging is not working due to multiple slf4j. If I exclude embedded jar completely logging works. But I need embedded jar but not glassfish slf4j.

Any Solution?

Glassfish' Pom. It seems slf4j is a transitive dependancy

Community
  • 1
  • 1
Gibbs
  • 21,904
  • 13
  • 74
  • 138

1 Answers1

2

Have you try something like:

<dependency>
    <groupId>org.glassfish.main.extras</groupId>
    <artifactId>glassfish-embedded-all</artifactId>
    <version>4.0-b72</version>
    <exclusions>
        <exclusion>
             <groupId>org.slf4j</groupId>
             <artifactId>*</artifactId>
        </exclusion>
    </exclusions>
</dependency>

UPDATE

The slf4j classes are embedded. If you still want to work with an uber jar, an option is to shade glassfish-embedded-all, i.e. to create a maven project or a module with:

<dependencies>
    <dependency>
        <groupId>org.glassfish.main.extras</groupId>
        <artifactId>glassfish-embedded-all</artifactId>
        <version>4.0-b72</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.4.3</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <filters>
                            <filter>
                                <artifact>*:*</artifact>
                                <excludes>
                                    <exclude>**/org/slf4j/**/*</exclude>
                                </excludes>
                            </filter>
                        </filters>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

and then to use the generated jar in place of glassfish-embedded-all.

atao
  • 835
  • 6
  • 13
  • I tried this man. But it didn't help. I am using maven2. I guess there is no wild card support – Gibbs Feb 02 '16 at 06:55
  • I just updated my answer. maven-shade-plugin version 2+ requires Maven 3. But you can try with version 1.7.1 that requires only Maven 2.0.6. – atao Feb 02 '16 at 09:11