Java

Java programs run in a virtual machine independent of the operating system.

Maven

Maven is the java package and dependency management tool. Java repositories can be used by Windows and Linux operating systems. With a SMB the repository can be used as a local repository for both operating systems.

Maven
#!/bin/bash
java -version
mvn --version
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false -Dmaven.repo.local=/tmp/pub/repo

xqilla -i my-app/pom.xml <( cat <<-'POM'
        declare namespace xsi = "http://www.w3.org/2001/XMLSchema-instance";
        declare default element namespace "http://maven.apache.org/POM/4.0.0";
        declare variable $build external ;
                element {"project"} {
                        attribute {"xsi:schemaLocation"} {
                                "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
                        },
                        ./project/*,
                        doc($build)
                }
POM
) -v build <( cat <<-'XML'
        <?xml version="1.0"?>
        <build xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
          <plugins>
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-site-plugin</artifactId>
                  <version>3.3</version>
                </plugin>
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                  <version>2.7</version>
                </plugin>
                <!-- any other plugins -->
                <plugin>
                  <artifactId>maven-clean-plugin</artifactId>
                  <version>3.1.0</version>
                  <executions>
                        <execution>
                          <id>default-clean</id>
                          <phase>clean</phase>
                          <goals>
                                <goal>clean</goal>
                          </goals>
                        </execution>
                  </executions>
                </plugin>
                <plugin>
                  <artifactId>maven-assembly-plugin</artifactId>
                  <version>3.1.0</version>
                  <configuration>
                        <descriptorRefs>
                          <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <archive>
                          <manifest>
                                <mainClass>com.mycompany.app.App</mainClass>
                          </manifest>
                        </archive>
                  </configuration>
                  <executions>
                        <execution>
                          <id>make-assembly</id>
                          <!-- this is used for inheritance merges -->
                          <phase>package</phase>
                          <!-- bind to the packaging phase -->
                          <goals>
                                <goal>single</goal>
                          </goals>
                        </execution>
                  </executions>
                </plugin>
          </plugins>
        </build>
XML
) | xmllint --format --nowarning --output my-app/pom.xml -

cat my-app/pom.xml

mvn -Dmaven.compiler.source=1.6 -Dmaven.compiler.target=1.6 -Dmaven.repo.local=/tmp/pub/repo --file my-app/pom.xml help:effective-pom

mvn dependency:tree -Dverbose --file=my-app/pom.xml

mvn -Dmaven.compiler.source=1.6 -Dmaven.compiler.target=1.6 -Dmaven.repo.local=/tmp/pub/repo --file my-app/pom.xml dependency:tree

mvn compile -Dmaven.compiler.source=1.6 -Dmaven.compiler.target=1.6 -Dmaven.repo.local=/tmp/pub/repo --file my-app/pom.xml

mvn test -Dmaven.compiler.source=1.6 -Dmaven.compiler.target=1.6 -Dmaven.repo.local=/tmp/pub/repo --file my-app/pom.xml

mvn package -Dmaven.compiler.source=1.6 -Dmaven.compiler.target=1.6 -Dmaven.repo.local=/tmp/pub/repo --file my-app/pom.xml

jar cvfe my-app.jar com.mycompany.app.App  -C my-app/target/classes .

mvn -Dmaven.compiler.source=1.6 -Dmaven.coiler.target=1.6 -Dmaven.repo.local=/tmp/pub/repo --file my-app/pom.xml -Ddependency.locations.enabled=false site