Skip to content

Commit

Permalink
Use mvn.bat/sh when building a frank
Browse files Browse the repository at this point in the history
  • Loading branch information
jacodg committed Nov 16, 2023
1 parent 6e80c38 commit ba7731b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
18 changes: 11 additions & 7 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@
<property name="ant.zip.url" value="${ant.base.url}${ant.zip}"/>
<property name="ant.gz.url" value="${ant.base.url}${ant.gz}"/>
<property name="ant.dir" value="build/apache-ant-${ant.version.}"/>
<property name="maven.version" value="3.9.5"/>
<property name="maven.remark.line1" value="Maven will by default use 1.8 for source and target (independent of Java version being used to run Maven)"/>
<property name="maven.remark.line2" value="For example java 11 can be specified in the pom.xml of your project by adding property &lt;maven.compiler.release>11&lt;/maven.compiler.release>"/>
<property name="maven.version" value="3.9.5"/><!-- check whether remark above about 1.8 is still correct, see https://maven.apache.org/plugins/maven-compiler-plugin/ -->
<property name="maven.base" value="apache-maven-${maven.version}-bin"/>
<property name="maven.zip" value="${maven.base}.zip"/>
<property name="maven.tar" value="${maven.base}.tar"/>
Expand Down Expand Up @@ -427,12 +429,10 @@
<echo file="${maven.exec.dir}/.gitignore" message="&#10;" append="true" if:true="${project.gitignore.add.newline}"/>
<echo file="${maven.exec.dir}/.gitignore" message="${project.gitignore}" append="true" if:true="${project.gitignore.add}"/>
<delete includeEmptyDirs="true" verbose="${maven.verbose}" unless:true="${webapp.clean.skip}" if:true="${maven}"><fileset dir="${webapp.dir}" includes="${webapp.clean}" defaultexcludes="false"/></delete><!-- maven clean war:inplace doesn't clean the webapp (see also: https://stackoverflow.com/questions/12497081/maven-war-inplace-clean-classes-and-lib-folder) -->
<condition property="mvn.ext" value=".cmd" else=""><os family="windows"/></condition>
<property name="maven.jdk.dir" value="${jdk.17.dir}"/><!-- maven 3.9.5 default source and target is 1.8, values can be changed in pom.xml with property <maven.compiler.release>11</maven.compiler.release> -->
<property name="maven.jdk.dir.windows" value="${jdk.17.dir.windows}"/>
<exec executable="${basedir}\${maven.dir}\bin\mvn${mvn.ext}" dir="${maven.exec.dir}" vmlauncher="false" failonerror="true" if:true="${maven}">
<env key="JAVA_HOME" value="${basedir}/${maven.jdk.dir}" unless:true="${os.windows}"/>
<env key="JAVA_HOME" value="${basedir}\${maven.jdk.dir.windows}" if:true="${os.windows}"/>
<condition property="mvn.exe" value="${basedir}\mvn.bat" else="/bin/bash"><os family="windows"/></condition>
<condition property="mvn.arg" value="${basedir}/mvn.sh" else=""><os family="unix"/></condition>
<exec executable="${mvn.exe}" dir="${maven.exec.dir}" vmlauncher="false" failonerror="true" if:true="${maven}">
<arg value="${mvn.arg}" unless:blank="${mvn.arg}"/>
<arg value="--settings" if:set="maven.settings.xml"/>
<arg value="${maven.settings.xml}" if:set="maven.settings.xml"/>
<arg value="${maven.args}" if:set="maven.args"/>
Expand Down Expand Up @@ -909,6 +909,8 @@ if not exist "%~dp0${maven.dir.windows}" (
<echo file="${filename}.bat" append="true" unless:set="mvn">
set JAVA_HOME=%JDK_8_DIR%</echo>
<echo file="${filename}.bat" append="true" if:set="mvn">
rem ${maven.remark.line1}
rem ${maven.remark.line2}
set JAVA_HOME=%JDK_17_DIR%</echo>
<echo file="${filename}.bat" append="true">
set ANT_HOME=%~dp0${ant.dir.windows}</echo><!-- prevent problems on systems with ant installed (e.g. when ANT_HOME points to an old ant version that version will be used which might not support all tasks and attributes) -->
Expand Down Expand Up @@ -986,6 +988,8 @@ fi</echo>
<echo file="${filename}.sh" append="true" unless:set="mvn">
export JAVA_HOME="$${JDK_8_DIR}"</echo>
<echo file="${filename}.sh" append="true" if:set="mvn">
# ${maven.remark.line1}
# ${maven.remark.line2}
export JAVA_HOME="$${JDK_17_DIR}"</echo>
<echo file="${filename}.sh" append="true">
export ANT_HOME="$${FR_DIR}${ant.dir}"</echo><!-- prevent problems on systems with ant installed (e.g. when ANT_HOME points to an old ant version that version will be used which might not support all tasks and attributes) -->
Expand Down
2 changes: 2 additions & 0 deletions mvn.bat
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ if not exist "%JDK_17_DIR%" (
if not exist "%~dp0build\apache-maven-3.9.5" (
set RUN_INSTALL=true
)
rem Maven will by default use 1.8 for source and target (independent of Java version being used to run Maven)
rem For example java 11 can be specified in the pom.xml of your project by adding property <maven.compiler.release>11</maven.compiler.release>
set JAVA_HOME=%JDK_17_DIR%
set ANT_HOME=%~dp0build\apache-ant-1.10.10
if "%RUN_INSTALL%" == "true" (
Expand Down
2 changes: 2 additions & 0 deletions mvn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ fi
if [[ ! -d "${FR_DIR}build/apache-maven-3.9.5" ]]; then
RUN_INSTALL="true"
fi
# Maven will by default use 1.8 for source and target (independent of Java version being used to run Maven)
# For example java 11 can be specified in the pom.xml of your project by adding property <maven.compiler.release>11</maven.compiler.release>
export JAVA_HOME="${JDK_17_DIR}"
export ANT_HOME="${FR_DIR}build/apache-ant-1.10.10"
if [[ "$RUN_INSTALL" == "true" ]]; then
Expand Down
5 changes: 2 additions & 3 deletions specials/iaf-example/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<delete dir="../../../iaf/webapp/src/main/webapp/WEB-INF/lib" verbose="${maven.verbose}" unless:true="${maven.skip.clean}"/>

<echo message="iaf-example: Build iaf"/>
<exec dir="../../../iaf" executable="${mvn.exe}" vmlauncher="false" failonerror="true">
<exec executable="${mvn.exe}" dir="../../../iaf" vmlauncher="false" failonerror="true">
<arg value="${mvn.arg}" unless:blank="${mvn.arg}"/>
<arg value="clean" unless:true="${maven.skip.clean}"/>
<arg value="install"/>
Expand All @@ -56,8 +56,7 @@
<arg value="-Dmaven=true"/>
<arg value="-Dmaven.skip.clean=${maven.skip.clean}"/>
<arg value="-Dmaven.verbose=${maven.verbose}"/>
<!-- Folder target already present in iaf/.gitginore -->
<arg value="-Dproject.gitignore.skip=true"/>
<arg value="-Dproject.gitignore.skip=true"/><!-- Folder target already present in iaf/.gitginore -->
<arg value="-Dtests.dir=src/test/resources/TestTool"/>
</exec>
</target>
Expand Down
11 changes: 4 additions & 7 deletions specials/iaf-test/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<delete dir="../../../iaf/webapp/src/main/webapp/WEB-INF/lib" verbose="${maven.verbose}" unless:true="${maven.skip.clean}"/>

<echo message="iaf-test: Build iaf"/>
<exec dir="../../../iaf" executable="${mvn.exe}" vmlauncher="false" failonerror="true">
<exec executable="${mvn.exe}" dir="../../../iaf" vmlauncher="false" failonerror="true">
<arg value="${mvn.arg}" unless:blank="${mvn.arg}"/>
<arg value="clean" unless:true="${maven.skip.clean}"/>
<arg value="install"/>
Expand All @@ -56,12 +56,9 @@
<arg value="-Dmaven=true"/>
<arg value="-Dmaven.skip.clean=${maven.skip.clean}"/>
<arg value="-Dmaven.verbose=${maven.verbose}"/>
<!-- Folder target already present in iaf/.gitginore -->
<arg value="-Dproject.gitignore.skip=true"/>
<!-- In DeploymentSpecifics.properties the configurations part of the path is added to configurations.*.* properties, hence remove it here from configurations.dir that has default value src/main/configurations -->
<arg value="-Dconfigurations.dir=src/main"/>
<!-- A number of test scenario's of iaf-test depend on ${web.contextpath} -->
<arg value="-Dweb.contextpath=/"/>
<arg value="-Dproject.gitignore.skip=true"/><!-- Folder target already present in iaf/.gitginore -->
<arg value="-Dconfigurations.dir=src/main"/><!-- In DeploymentSpecifics.properties the configurations part of the path is added to configurations.*.* properties, hence remove it here from configurations.dir that has default value src/main/configurations -->
<arg value="-Dweb.contextpath=/"/><!-- A number of test scenario's of iaf-test depend on ${web.contextpath} -->
<!--
Optionally change application.server.type.custom as described in StageSpecifics_LOC.properties
Please note that ACTIVEMQ requires extra jar files that the Frank!Runner doesn't download yet, see:
Expand Down
14 changes: 5 additions & 9 deletions specials/iaf-webapp/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</exec>

<echo message="iaf-webapp: Build iaf"/>
<exec dir="../../../iaf" executable="${mvn.exe}" vmlauncher="false" failonerror="true">
<exec executable="${mvn.exe}" dir="../../../iaf" vmlauncher="false" failonerror="true">
<arg value="${mvn.arg}" unless:blank="${mvn.arg}"/>
<arg value="clean" unless:true="${maven.skip.clean}"/>
<arg value="install"/>
Expand All @@ -56,14 +56,10 @@
<arg value="-Dmaven=true"/>
<arg value="-Dmaven.skip.clean=${maven.skip.clean}"/>
<arg value="-Dmaven.verbose=${maven.verbose}"/>
<!-- Folder target already present in iaf/.gitginore -->
<arg value="-Dproject.gitignore.skip=true"/>
<!-- Don't gitignore resources in webapp except javax.xml.stream.XMLInputFactory because this is the iaf-webapp artifact that should contain those resources (which are stored in git, in the src/main/webapp folder) (javax.xml.stream.XMLInputFactory is copied from src/main/resources) -->
<arg value="-Dwebapp.gitignore=WEB-INF/classes/META-INF/services/**"/>
<!-- Don't clean resources in webapp except lib folder because this is the iaf-webapp artifact that should contain those resources (which are stored in git, in the src/main/webapp folder) -->
<arg value="-Dwebapp.clean=WEB-INF/lib/**"/>
<!-- Run webapp with configurations and tests from another project as it doesn't have it's own -->
<arg value="-Dconfigurations.dir=${configurations.dir}"/>
<arg value="-Dproject.gitignore.skip=true"/><!-- Folder target already present in iaf/.gitginore -->
<arg value="-Dwebapp.gitignore=WEB-INF/classes/META-INF/services/**"/><!-- Don't gitignore resources in webapp except javax.xml.stream.XMLInputFactory because this is the iaf-webapp artifact that should contain those resources (which are stored in git, in the src/main/webapp folder) (javax.xml.stream.XMLInputFactory is copied from src/main/resources) -->
<arg value="-Dwebapp.clean=WEB-INF/lib/**"/><!-- Don't clean resources in webapp except lib folder because this is the iaf-webapp artifact that should contain those resources (which are stored in git, in the src/main/webapp folder) -->
<arg value="-Dconfigurations.dir=${configurations.dir}"/><!-- Run webapp with configurations and tests from another project as it doesn't have it's own -->
<arg value="-Dtests.dir=${tests.dir}"/>
</exec>
</target>
Expand Down

0 comments on commit ba7731b

Please sign in to comment.