From 69d04cae268bd764015f41562f3500dbde652d0d Mon Sep 17 00:00:00 2001 From: Scott Fennell Date: Fri, 31 Jan 2020 13:25:38 -0600 Subject: [PATCH] refactor Makefile to use configure to find executable for maven --- share/trick/makefiles/config_user.mk.in | 1 + trick_source/java/CMakeLists.txt | 2 +- trick_source/java/Makefile | 13 ++++++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/share/trick/makefiles/config_user.mk.in b/share/trick/makefiles/config_user.mk.in index a7d8db50..c0f7c6b9 100644 --- a/share/trick/makefiles/config_user.mk.in +++ b/share/trick/makefiles/config_user.mk.in @@ -11,6 +11,7 @@ SWIG = @SWIG@ PYTHON = @PYTHON@ CLANG = @CLANG@ TEE = @TEE@ +MVN = @MVN@ USE_JAVA = @USE_JAVA@ JAVAC = @JAVA_CC@ diff --git a/trick_source/java/CMakeLists.txt b/trick_source/java/CMakeLists.txt index 0a2d648e..f3c7836e 100644 --- a/trick_source/java/CMakeLists.txt +++ b/trick_source/java/CMakeLists.txt @@ -3,4 +3,4 @@ # Build Java ############################################################### -add_custom_target(java COMMAND mvn package -Dcmake=true -DbuildDirectory=${CMAKE_BINARY_DIR}/libexec/trick/java/build WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +add_custom_target(java COMMAND ${MAVEN_EXECUTABLE} -q package -Dcmake=true -DbuildDirectory=${CMAKE_BINARY_DIR}/libexec/trick/java/build WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/trick_source/java/Makefile b/trick_source/java/Makefile index df3e3d6c..5b2b307d 100644 --- a/trick_source/java/Makefile +++ b/trick_source/java/Makefile @@ -1,13 +1,20 @@ TRICK_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))../..) +JAVA_BUILD_DIR = ${TRICK_HOME}/libexec/trick/java/build +include ${TRICK_HOME}/share/trick/makefiles/Makefile.common all: ${TRICK_HOME}/libexec/trick/java/build @echo "Java build successful" ${TRICK_HOME}/libexec/trick/java/build: - mvn package + @echo "Building java application... For details see ${JAVA_BUILD_DIR}/maven.out" + @mkdir ${JAVA_BUILD_DIR} + @${MVN} package &> ${JAVA_BUILD_DIR}/maven.out javadoc: - mvn javadoc:javadoc + ${MVN} javadoc:javadoc clean: - mvn clean + @rm -rf ${JAVA_BUILD_DIR} + @echo java build directory cleaned. + +