build.xml
Buildovací nástroj.
Obsahuje JAVA knihovny různých verzí (i zdrojové kódy a dokumentace).
shell# mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=cz.isn.testapp -DartifactId=testapp
testapp |-- pom.xml `-- src |-- main | `-- java | `-- cz | `-- isn | `-- testapp | `-- App.java `-- test `-- java `-- cz `-- isn `-- testapp `-- AppTest.java
POM = Project Object Model
<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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>cz.isn.testapp</groupId> <artifactId>testapp</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>testapp</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project>
File → New Project → Categories: Maven → Projects: Java Application
Stažení a rozbalení balíku
shell# mkdir /opt/ci shell# cd /opt/ci shell# wget -c -t 0 http://mirror.hosting90.cz/apache/maven/maven-3/3.1.0/binaries/apache-maven-3.1.0-bin.tar.gz shell# tar xvzf apache-maven-3.1.0-bin.tar.gz
Vytvořit konfiguraci pro path
# maven path export MAVEN_HOME=/opt/ci/apache-maven-3.1.0 export PATH=${MAVEN_HOME}/bin:${PATH}
Odhásit, přihlásit a otestovat
shell$ mvn -version Apache Maven 3.1.0 ... Maven home: /opt/ci/apache-maven-3.1.0 Java version: 1.6.0_45, vendor: Sun Microsystems Inc. Java home: /opt/java-jboss/jdk1.6.0_45/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "2.6.32-042stab078.28", arch: "amd64", family: "unix"
;%MAVEN_HOME%\bin
C:\Users\blazek>mvn -version Apache Maven 3.1.0 ... Maven home: C:\work\JAVA\ci\apache-maven-3.1.0\bin\.. Java version: 1.6.0_45, vendor: Sun Microsystems Inc. Java home: C:\Program Files\Java\jdk1.6.0_45\jre Default locale: cs_CZ, platform encoding: Cp1250 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
build.gradle