I am in the process of creating a port for a java based application that uses maven for the build. This is my first port and am a complete noob to this, though I have read through some of the porters guide. I am just looking to be pointed in the right direction for resolving the issues below and for improving the port in general.
I have a port that works. I can do make install, make clean, make deinstall and they all work as expected. However, I think there may be better ways to do some of the things that I am doing.
First Issue:
For those not familiar with maven, it is a build tool similar to make with the ports. It downloads necessary dependencies when you build. By default, it downloads all of the application dependencies to ~/.m2/repository. However, the base directory can be overridden. I have told it put the files into /usr/ports/distfiles/.m2/repository. I thought about putting the files into the <port directory>/work/.m2/repository. However, doing a make clean would wipe out the dependencies and other ports based on maven could potentially reuse the repository if it were in /usr/ports/distfiles
Is there a recommended approach in this case?
Second Issue:
Maven is a build tool like make. At first I thought I could just trick the port into using maven by setting a few variables like this:
This kinda worked, but it posed some issues.
Here is my current Makefile
Here is my distinfo
pkg-plist
pkg-descr
contents of the repose-1.0.6 directory
./distinfo
./files
./files/etc
./files/etc/versioning.cfg.xml
./files/etc/power-proxy.cfg.xml
./files/etc/http-logging.cfg.xml
./files/etc/container.cfg.xml
./files/etc/content-normalization.cfg.xml
./files/bin
./files/bin/start-valve.sh
./pkg-descr
./Makefile
./pkg-plist
Here is the resulting install (under /usr/local)
repose-1.0.6
repose-1.0.6/bin
repose-1.0.6/bin/start-valve.sh
repose-1.0.6/bin/repose-valve.jar
repose-1.0.6/etc
repose-1.0.6/etc/powerapi
repose-1.0.6/etc/powerapi/container.cfg.xml
repose-1.0.6/etc/powerapi/content-normalization.cfg.xml
repose-1.0.6/etc/powerapi/http-logging.cfg.xml
repose-1.0.6/etc/powerapi/power-proxy.cfg.xml
repose-1.0.6/etc/powerapi/versioning.cfg.xml
repose-1.0.6/lib
repose-1.0.6/lib/filters
repose-1.0.6/lib/filters/filter-bundle-1.0.6.ear
repose-1.0.6/var
repose-1.0.6/var/powerapi
repose-1.0.6/logs
repose-1.0.6/docs
repose-1.0.6/docs/repose-authn-deploy.pdf
repose-1.0.6/docs/repose-glossary.pdf
repose-1.0.6/docs/repose-intro.pdf
repose-1.0.6/docs/repose-logging-deploy.pdf
repose-1.0.6/docs/repose-ratelimiting-deploy.pdf
repose-1.0.6/docs/repose-rootwar-deploy.pdf
repose-1.0.6/docs/repose-versioning-deploy.pdf
repose-1.0.6/docs/ReposePresentation.pdf
I have a port that works. I can do make install, make clean, make deinstall and they all work as expected. However, I think there may be better ways to do some of the things that I am doing.
First Issue:
For those not familiar with maven, it is a build tool similar to make with the ports. It downloads necessary dependencies when you build. By default, it downloads all of the application dependencies to ~/.m2/repository. However, the base directory can be overridden. I have told it put the files into /usr/ports/distfiles/.m2/repository. I thought about putting the files into the <port directory>/work/.m2/repository. However, doing a make clean would wipe out the dependencies and other ports based on maven could potentially reuse the repository if it were in /usr/ports/distfiles
Is there a recommended approach in this case?
Second Issue:
Maven is a build tool like make. At first I thought I could just trick the port into using maven by setting a few variables like this:
Code:
MAKE=mvn
MAKE_ARGS=-Duser.home=${DISTDIR}
MAKEFILE=pom.xml
ALL_TARGET=install
This kinda worked, but it posed some issues.
Here is my current Makefile
Code:
# New ports collection Makefile for: repose
# Date created: 10 January 2012
# Whom: Dan Daley <dddaley@yahoo.com>
#
# $FreeBSD$
PORTNAME= papi
PORTVERSION= 1.0.6
CATEGORIES= devel java
MASTER_SITES= http://nodeload.github.com/rackspace/repose/tarball/
MAINTAINER= dddaley@yahoo.com
COMMENT= RESTful Proxy Service
EXTRACT_SUFX=
BUILD_DEPENDS= ${LOCALBASE}/openjdk6/bin/java:${PORTSDIR}/java/openjdk6 \
${LOCALBASE}/share/java/maven3/bin/mvn:${PORTSDIR}/devel/maven3
RUN_DEPENDS= ${BUILD_DEPENDS}
USE_JAVA= yes
JAVA_VERSION= 1.6
JAVA_VENDOR= openjdk
PORTHOME= ${PORTSDIR}/java/repose-${PORTVERSION}
NOCLEANDEPENDS= yes
#MAKE= mvn
#MAKE_ARGS= -D user.home=${DISTDIR}
#MAKEFILE= pom.xml
#ALL_TARGET= install
MVN_OPTS= MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m"
MVN= mvn
MVN_ARGS= -Duser.home=${DISTDIR}/
#MVN_ARGS= -Duser.home=${PORTHOME}/
MVN_TARGET= install
MVN_CLEAN_TARGET=clean
#Install related
PREFIXDIR= ${PREFIX}/repose-${PORTVERSION}
PLIST_SUB+= PORTVERSION=${PORTVERSION}
post-extract:
${ECHO_CMD} "mv ${WRKDIR}/rackspace* ${WRKDIR}/${PORTNAME}-${PORTVERSION}"
${MV} ${WRKDIR}/rackspace* ${WRKDIR}/${PORTNAME}-${PORTVERSION}
clean-repo:
${ECHO_CMD} "rm -rf ${DISTDIR}/.m2"
${RM} -rf ${DISTDIR}/.m2
do-clean:
${ECHO_CMD} "cd ${WRKSRC} && ${MVN_OPTS} ${MVN} ${MVN_ARGS} ${MVN_CLEAN_TARGET}"
@(cd ${WRKSRC} && ${MVN_OPTS} ${MVN} ${MVN_ARGS} ${MVN_CLEAN_TARGET})
${ECHO_CMD} "cd ${PORTHOME} && ${RM} -rf ${WRKDIR}"
cd ${PORTHOME} && ${RM} -rf ${WRKDIR}
do-build:
${ECHO_CMD} "cd ${WRKSRC} && ${MVN_OPTS} ${MVN} ${MVN_ARGS} ${MVN_TARGET}"
@(cd ${WRKSRC} && ${MVN_OPTS} ${MVN} ${MVN_ARGS} ${MVN_TARGET})
do-install:
@${MKDIR} ${PREFIXDIR}
@${MKDIR} ${PREFIXDIR}/bin
@${MKDIR} ${PREFIXDIR}/etc
@${MKDIR} ${PREFIXDIR}/etc/powerapi
@${MKDIR} ${PREFIXDIR}/lib
@${MKDIR} ${PREFIXDIR}/lib/filters
@${MKDIR} ${PREFIXDIR}/var
@${MKDIR} ${PREFIXDIR}/var/powerapi
@${MKDIR} ${PREFIXDIR}/logs
@${MKDIR} ${PREFIXDIR}/docs
@(cd ${PORTHOME}/files/etc && ${COPYTREE_SHARE} \* ${PREFIXDIR}/etc/powerapi/)
@(cd ${PORTHOME}/files/bin && ${COPYTREE_SHARE} \* ${PREFIXDIR}/bin/)
@(cd ${WRKSRC}/project-set/core/valve/target && ${COPYTREE_SHARE} \repose-valve.jar ${PREFIXDIR}/bin/)
@(cd ${WRKSRC}/project-set/components/filter-bundle/target && ${COPYTREE_SHARE} \*.ear ${PREFIXDIR}/lib/filters/)
@(cd ${WRKSRC}/documentation/docbook/target/docbkx/pdf/ && ${COPYTREE_SHARE} \*.pdf ${PREFIXDIR}/docs/)
@(cd ${WRKSRC}/documentation/presentations/OpenStack_Essex_2011 && ${COPYTREE_SHARE} \*.pdf ${PREFIXDIR}/docs/)
.include <bsd.port.mk>
Here is my distinfo
Code:
SHA256 (papi-1.0.6) = be962cf8d0705bf3845bc64fdf6ff7f4bdce4ea6035eb4718f996a90c95e875c
SIZE (papi-1.0.6) = 3465112
pkg-plist
Code:
repose-1.0.6/bin/start-valve.sh
repose-1.0.6/bin/repose-valve.jar
repose-1.0.6/etc/powerapi/container.cfg.xml
repose-1.0.6/etc/powerapi/content-normalization.cfg.xml
repose-1.0.6/etc/powerapi/http-logging.cfg.xml
repose-1.0.6/etc/powerapi/http-logging.cfg.xml~
repose-1.0.6/etc/powerapi/power-proxy.cfg.xml
repose-1.0.6/etc/powerapi/versioning.cfg.xml
repose-1.0.6/lib/filters/filter-bundle-1.0.6.ear
repose-1.0.6/docs/repose-authn-deploy.pdf
repose-1.0.6/docs/repose-glossary.pdf
repose-1.0.6/docs/repose-intro.pdf
repose-1.0.6/docs/repose-logging-deploy.pdf
repose-1.0.6/docs/repose-ratelimiting-deploy.pdf
repose-1.0.6/docs/repose-rootwar-deploy.pdf
repose-1.0.6/docs/repose-versioning-deploy.pdf
repose-1.0.6/docs/ReposePresentation.pdf
@dirrm repose-1.0.6/bin
@dirrm repose-1.0.6/etc/powerapi
@dirrm repose-1.0.6/etc
@dirrm repose-1.0.6/lib/filters
@dirrm repose-1.0.6/lib
@dirrm repose-1.0.6/var/powerapi
@dirrm repose-1.0.6/var
@dirrm repose-1.0.6/logs
@dirrm repose-1.0.6/docs
@dirrm repose-1.0.6
pkg-descr
Code:
REPOSE is an open-source RESTful HTTP proxy service that scales to the cloud.
REPOSE provides the solution to common API processing tasks such as rate
limiting, client authentication, versioning, and logging so that web service
developers can focus on the unique features of their services.
WWW: http://www.openrepose.org/
contents of the repose-1.0.6 directory
./distinfo
./files
./files/etc
./files/etc/versioning.cfg.xml
./files/etc/power-proxy.cfg.xml
./files/etc/http-logging.cfg.xml
./files/etc/container.cfg.xml
./files/etc/content-normalization.cfg.xml
./files/bin
./files/bin/start-valve.sh
./pkg-descr
./Makefile
./pkg-plist
Here is the resulting install (under /usr/local)
repose-1.0.6
repose-1.0.6/bin
repose-1.0.6/bin/start-valve.sh
repose-1.0.6/bin/repose-valve.jar
repose-1.0.6/etc
repose-1.0.6/etc/powerapi
repose-1.0.6/etc/powerapi/container.cfg.xml
repose-1.0.6/etc/powerapi/content-normalization.cfg.xml
repose-1.0.6/etc/powerapi/http-logging.cfg.xml
repose-1.0.6/etc/powerapi/power-proxy.cfg.xml
repose-1.0.6/etc/powerapi/versioning.cfg.xml
repose-1.0.6/lib
repose-1.0.6/lib/filters
repose-1.0.6/lib/filters/filter-bundle-1.0.6.ear
repose-1.0.6/var
repose-1.0.6/var/powerapi
repose-1.0.6/logs
repose-1.0.6/docs
repose-1.0.6/docs/repose-authn-deploy.pdf
repose-1.0.6/docs/repose-glossary.pdf
repose-1.0.6/docs/repose-intro.pdf
repose-1.0.6/docs/repose-logging-deploy.pdf
repose-1.0.6/docs/repose-ratelimiting-deploy.pdf
repose-1.0.6/docs/repose-rootwar-deploy.pdf
repose-1.0.6/docs/repose-versioning-deploy.pdf
repose-1.0.6/docs/ReposePresentation.pdf