JTwitter - the Java library for the Twitter API. JTwitter - the Java library for the Twitter API. Robust & easy to use. Over 200,000 downloads and many successful apps. As used by coders, companies & in several university courses. JTwitter is a small library providing easy access to the Twitter API.
. 33. 0. My challenge is simple: I am creating a small Java application – single class with main method – that has many direct and indirect dependencies.
In order to run my simple class locally I need to:. code the Java Class. compile the class. run the class In order to compile the class, all directly referenced classes from supporting libraries should be available. To run the class, all indirectly invoked classes should also be available.
That means that in addition to the.class file that is result of compiling my Java code, I need a large number of JAR-files. Maven is a great mechanism for describing the dependencies of a project. With a few simple XML elements, I can indicate which libraries my application has a direct dependency on. The Maven pom.xml file is where these dependencies are described.
Maven uses these dependencies during compilation – to have all direct dependent classes available for the compiler. In order to help out with all run time dependencies, Maven also can download all jar-files for the direct and even the indirect dependencies. Take the dependencies in this pom.xml file (for a Java application that will work with Kafka Streams): 4.0.0 nl.amis.streams.countries Country-Events-Analyzer jar 1.0-SNAPSHOT Country-Events-Analyzer org.apache.kafka kafka-streams 0.10.0.0 org.apache.kafka kafka-clients 0.10.0.0 com.fasterxml.jackson.core jackson-databind 2.7.4 junit junit 3.8.1 test org.rocksdb rocksdbjni 4.9.0 org.apache.maven.plugins maven-compiler-plugin 3.1 1.8 1.8 The number of JAR files required to eventually run the generated class is substantially. To find all these JAR-files manually is not simple: it may not be so simple to determine which files are required, the files may not be easy to locate and the indirect dependencies (stemming from the JAR files that the application directly depends on) are almost impossible to determine. Using a simple Maven instruction, all JAR files are gathered and copied to a designated directory.
Before the operation, here is the application. Note that the target directory is empty. The statement to use is: mvn install dependency:copy-dependencies This will instruct Maven to analyze the pom.xml file, find the direct dependencies, find the associated JAR files, determine the indirect dependencies for each of these direct dependencies and process them similarly and recursively. Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director and Oracle Developer Champion. Solution architect and developer on diverse areas including SQL, JavaScript, Kubernetes & Docker, Machine Learning, Java, SOA and microservices, events in various shapes and forms and many other things.
Author of the Oracle Press book Oracle SOA Suite 12c Handbook. Frequent presenter on user groups and community events and conferences such as JavaOne, Oracle Code, CodeOne, NLJUG JFall and Oracle OpenWorld. Related Posts. Leave a Reply This site uses Akismet to reduce spam.
About Author Lucas Jellema Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director and Oracle Developer Champion. Solution architect and developer on diverse areas including SQL, JavaScript, Kubernetes & Docker, Machine Learning, Java, SOA and microservices, events in various shapes and forms and many other things. Author of the Oracle Press book Oracle SOA Suite 12c Handbook. Frequent presenter on user groups and community events and conferences such as JavaOne, Oracle Code, CodeOne, NLJUG JFall and Oracle OpenWorld.