Wednesday, March 29, 2017

How to deal with transitive maven dependencies?

Hello,

my app uses a separate jar library, which in turn uses another jar file, e. g. a postgresql driver:

Maven project "mylib", pom.xml:

   <dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>42.0.0</version>
   </dependency>

Maven project "myapp", pom.xml:

    <dependency>
      <groupId>mylib</groupId>
      <artifactId>mylib</artifactId>
      <version>1.0-SNAPSHOT</version>
      <scope>provided</scope>
    </dependency>

When I build mylib with mvn package install, the PostgreSQL jar file is not included or downloaded.
Also when I build myapp with mvn package, the PostgreSQL jar is not fetched.
So I end up with a missing jar file.

I think (and also strongly hope) that it's one of the strengths of Maven that I do not have to repeat the dependency in the myapp project?

Maybe this has something to do with the fact, that no class of the PostgreSQL jar file is referenced directly, and therefore not seen by the compiler. When the PostgreSQL driver is needed, it's loaded by a String:

Class.forName ("org.postgresql.Driver");

How can you include all dependent libraries in the final app package?

Thanks
Magnus

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment