The 53rd Installment
"Java Language and Maven Repository"
by Takeyuki Nagao,
Assistant professor, Major : Information Systems Architecture
Java Language and Maven Repository
In general, there are two types of applications that end-users use: a server-side application used through a Web browser via a network and a client-side application installed and used on a device such as a computer. Although Java development can be done on both types of application, it is commonly done on a server-side application.
There are multiple reasons. When looking from the end-users' point of view, a server-side application can be used whenever they want without any preparation, including installation and initial settings. However, it is likely impossible to skip the application installation step before using a client-side application.
While, when looking from the developers' point of view, it is easier to develop applications for a server-side application by employing open-source software. With Java, there are many developers publishing their open-source library, which allows others to search for libraries on search engines such as the Maven Central Search Engine [1] and mvnrepository [2].
A problem when leveraging such libraries is the license. License types vary depending on the library and include many types, such as the GPL (GNU General Public License) type of license with many restrictions on application distribution and the BSD (Berkeley Software Distribution) type of license with fewer restrictions. Since the application itself is not distributed to end-users on a server-side application, it has fewer license restrictions compared to client-side applications. These are the reasons why server-side applications tend to be commonly used.
The standard method for using third party libraries with Java language is to use the Apache Maven [3] (hereafter Maven), which is a tool to mainly automate compilation, testing, and distribution of Java programs. It also has the feature to allow users to use third party libraries in their own project with a few lines of configuration file coding. Another function enables publishing developed libraries on the Internet (or intranet) repository.
To publish a library with Maven, a developer first develops a library with Java and then creates a JAR file, which is the library distribution unit. A JAR file contains a library in Java byte-code format. Then, a POM (Project Object Model), data for library management, must be coded in XML format. A POM file includes the following information.
- Group name of the developer
- Library name (name of the deliverable)
- Version number
- Information for build and compilation
- Dependency information (a list of external library to depend on)
By registering a JAR file and a POM file as a set into a Maven repository site, publishing a library is complete.
One significant point of the POM file is that it allows users to manage dependency information-which library depends on which. This kind of dependency management was not automated before Maven became mainstream; therefore, library dependency had to be identified manually. However, with the POM file dependency information and Maven's dependency management function, library dependency can now be automated.
When it comes to Java open-source libraries, a significant number of libraries are already shared in Maven open repositories. For example, a total of more than 250,000 libraries (including same libraries with different versions) are provided in a search engine called "mvnrepository", which means many of the functions that developers require are already implemented and public in an easy-to-reuse manner.
Software development usually involves not only one but several developers who cooperate to create software. The cooperation includes divisional cooperation within a development team as well as cooperation with other teams in its broadest sense, which means developers reuse deliverables from other teams, if necessary, modify them, and then place the modified result into their own deliverable. Focusing on systems supporting the latter method of cooperation is the key to the development of open-source software. For Java, Maven is a standard tool to support such cooperative work.
Libraries accumulated in the Maven repository are shared assets that Java developer communities have been accumulating for many years. Thinking of passing along to end-users the benefits of the shared assets, it is not ideal to stick to server-side applications only. So the challenge will now be to enable end-users on client-side applications to leverage the libraries and applications accumulated in the Maven repository anytime they want. The Apache Ivy Project is a tool developed for the purpose of making it easier to use Maven's dependency management function. I hope that it becomes the first step in addressing this issue.
[1] Maven Central Search Engine, http://search.maven.org/
[2] mvnrepository, http://mvnrepository.com/
[3] Apache Maven, http://maven.apache.org/
[4] Apache Ivy, http://ant.apache.org/ivy/