abashev / vfs-s3

Amazon S3 driver for Apache commons-vfs (Virtual File System) project
Apache License 2.0
92 stars 50 forks source link

java.lang.ClassNotFoundException: org.slf4j.LoggerFactory and why slf4j dependency. #63

Closed angelcervera closed 4 years ago

angelcervera commented 4 years ago

A simple project with these dependencies (aws libraries are transitive dependencies so no included):

  <dependencies>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-vfs2</artifactId>
      <version>2.4.1</version>
    </dependency>
    <dependency>
      <groupId>com.github.abashev</groupId>
      <artifactId>vfs-s3</artifactId>
      <version>4.0.0</version>
    </dependency>
  </dependencies>

And this simple code:

    public static void main( String[] args ) throws FileSystemException {
        FileSystemManager vfs = VFS.getManager();
    }

Throws this exception:

Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory

So two questions:

  1. Why in your pom, the slf4j dependency scope is provided?
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>1.7.21</version>
            <scope>provided</scope>
        </dependency>
  1. Why are not you using commons-logging like aws-sdk libraries and commons-vfs2 are doing? Both libraries are forced dependency in your case, so why to add a new dependency that it is not necessary at all.
abashev commented 4 years ago

Fixed in 4.1.0