# Tanım: Bir Java proje yönetimi ve proje anlama aracı
# URL: http://maven.apache.org
# Paketçi: milisarge
# Gerekler: openjdk
# Grup: geliştirme

isim=maven
surum=3.6.0
devir=1
kaynak=(http://apache-mirror.rbc.ru/pub/apache/maven/maven-3/$surum/source/apache-maven-$surum-src.tar.gz
	    maven.sh)


derle() {
    binsurum=3.5.4
	mkdir $SRC/maven-bin
	if [ ! -f $DERLEME_KAYNAKDIZIN/apache-maven-${binsurum}-bin.tar.gz ];then
		wget http://apache-mirror.rbc.ru/pub/apache/maven/maven-3/${binsurum}/binaries/apache-maven-${binsurum}-bin.tar.gz \
		-P $DERLEME_KAYNAKDIZIN/
	fi
	[ -f $DERLEME_KAYNAKDIZIN/apache-maven-${binsurum}-bin.tar.gz ] && tar xf $DERLEME_KAYNAKDIZIN/apache-maven-${binsurum}-bin.tar.gz \
	-C $SRC/maven-bin
	cd "$SRC"/apache-maven-$surum
	 export PATH="/usr/lib/jvm/java-8-openjdk/bin:${SRC}/maven-bin/apache-maven-3.5.4/bin:${PATH}"
  mvn package \
    -Dmaven.repo.local="${SRC}/repo" \
    -Dproject.build.sourceEncoding=UTF-8 -e

  install -Dm 755 ../maven.sh -t "${PKG}/etc/profile.d"
  install -d "${PKG}/opt/maven"

  mvn install \
    -Dmaven.repo.local="${SRC}/repo" \
    -Dproject.build.sourceEncoding=UTF-8 -e \
    -DdistributionTargetDir="${PKG}/opt/maven" \
    -DskipTests -Dmaven.test.skip=true

  install -d "${PKG}/usr/bin"
  ln -s /opt/maven/bin/mvn "${PKG}/usr/bin/mvn"
  ln -s /opt/maven/bin/mvnDebug "${PKG}/usr/bin/mvnDebug"
}
