English
Name two typical Java build systems and how you can identify which one is being used
One could put invocation of `javac` to Makefile and simplify the compilation a bit. It might be sufficient for such a simple project, but it would quickly become hard to build more complex projects with this approach. Java world knows several high-level build systems which can highly simplify building of Java projects. Among the others, probably most known are http://maven.apache.org/[Apache Maven] and http://ant.apache.org/[Apache Ant].
Optionaly the source code of our project (called source JAR then)
`org.fedoraproject.helloworld`
`org.fedoraproject.helloworld.input`
org/fedoraproject/helloworld/input/Input.java
org/fedoraproject/helloworld/output/Output.java
org/fedoraproject/helloworld/HelloWorld.java
`org.fedoraproject.helloworld.output`
`Output` class used only for output on terminal
Please note that two JAR files are separated by colon in a classpath definition.
Print out ``Hello World from'' and the name from previous step
<project name="MyProject" default="dist" basedir=".">
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.myproject</groupId>
<artifactId>myproject</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>myproject</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Quiz for Packagers
Resource files such as images or localisation data
See also xref:maven.adoc#maven[Maven] and xref:ant.adoc#ant[Ant] sections.
See http://docs.oracle.com/javase/8/docs/technotes/tools/windows/classpath.html[official documentation] for more information about classpath.
Setting the classpath
Some projects that use Apache Ant also use Apache Ivy to simplify dependency handling. Ivy is capable of resolving and downloading artifacts from Maven repositories which are declaratively described in XML. Project usually contains one or more `ivy.xml` files specifying the module Maven coordinates and its dependencies. Ivy can also be used directly from Ant build files. To detect whether the project you wish to package is using Apache Ivy, look for files named `ivy.xml` or nodes in the `ivy` namespace in project's build file.
<target name="clean" description="Clean build files">
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
<target name="compile" depends="init"
description="Compile the source">
<javac srcdir="${src}" destdir="${build}"/>
</target>