Getting Started With TrueZIP 7 in 5 Minutes

Here’s how to get started with TrueZIP 7.0 in five minutes, presuming you have Apache Maven version 3.0.3 or later installed and available on your shell command search path.

First, start a shell and type:

$ mvn archetype:generate -B
    -DarchetypeGroupId=de.schlichtherle.truezip
    -DarchetypeArtifactId=truezip-archetype-file
    -DarchetypeVersion=RELEASE
    -DgroupId=com.company
    -DartifactId=project
    -Dversion=1.0-SNAPSHOT
    -Dpackage=com.company.project

This should create a new directory named project in your current directory. Now type:

$ cd project
$ mvn clean install

This should build the sample project and install it to your local Maven repository. Now type:

$ mvn exec:java -Dexec.mainClass=com.company.project.Tree

This will run the sample application class Tree. At the end of the output, it should produce the following output:

.
|-- pom.xml
|-- src
|   `-- main
|       `-- java
|           `-- com
|               `-- company
|                   `-- project
|                       |-- Application.java
|                       |-- Copy.java
|                       `-- Tree.java
`-- target
    |-- classes
    |   `-- com
    |       `-- company
    |           `-- project
    |               |-- Application.class
    |               |-- Copy.class
    |               `-- Tree.class
    |-- generated-sources
    |   `-- annotations
    |-- maven-archiver
    |   `-- pom.properties
    |-- project-1.0-SNAPSHOT.jar
    |   |-- META-INF
    |   |   |-- MANIFEST.MF
    |   |   `-- maven
    |   |       `-- com.company
    |   |           `-- project
    |   |               |-- pom.xml
    |   |               `-- pom.properties
    |   `-- com
    |       `-- company
    |           `-- project
    |               |-- Application.class
    |               |-- Copy.class
    |               `-- Tree.class
    `-- surefire

Note that the contents of the JAR file target/project-1.0-SNAPSHOT.jar in line 24 get listed, too! This is because the configuration file pom.xml added the module TrueZIP Driver ZIP with the artifactId truezip-driver-zip to the runtime class path, which makes the application recognize ZIP files as virtual file systems and hence treat them like virtual directories.

Now you can take a look at the source code and update it to your liking. Make sure to check the FAQ, too.

That’s it - enjoy TrueZIP!