2525@ Mojo (name = "run" )
2626public class RunMojo extends AbstractFunctionMojo {
2727 protected static final String FUNC_CMD = "func -v" ;
28- protected static final String FUNC_HOST_START_CMD = "func host start -p %s" ;
28+ protected static final String FUNC_HOST_START_CMD = "func host start %s" ;
2929 protected static final String RUN_FUNCTIONS_FAILURE = "Failed to run Azure Functions. Please checkout console output." ;
3030 protected static final String RUNTIME_NOT_FOUND = "Azure Functions Core Tools not found. " +
3131 "Please go to https://aka.ms/azfunc-install to install Azure Functions Core Tools first." ;
3232 private static final String STAGE_DIR_FOUND = "Function App's staging directory found at: " ;
3333 private static final String STAGE_DIR_NOT_FOUND =
3434 "Stage directory not found. Please run mvn package first." ;
3535 private static final String RUNTIME_FOUND = "Azure Functions Core Tools found." ;
36- private static final String FUNC_HOST_START_WITH_DEBUG_CMD = "func host start -p %s --language-worker -- " +
36+ private static final String FUNC_HOST_START_WITH_DEBUG_CMD = "func host start %s --language-worker -- " +
3737 "\" -agentlib:jdwp=%s\" " ;
3838 private static final ComparableVersion JAVA_9 = new ComparableVersion ("9" );
3939 private static final ComparableVersion FUNC_3 = new ComparableVersion ("3" );
@@ -58,6 +58,14 @@ public class RunMojo extends AbstractFunctionMojo {
5858 */
5959 @ Parameter (property = "funcPort" , defaultValue = "7071" )
6060 protected Integer funcPort ;
61+
62+ /**
63+ * Config String for other start options than port and local debug
64+ *
65+ * @since 1.29.0
66+ */
67+ @ Parameter (property = "startOptions" , defaultValue = "" )
68+ protected String startOptions ;
6169 //region Getter
6270
6371 public String getLocalDebugConfig () {
@@ -146,12 +154,22 @@ protected String getStartFunctionHostCommand() {
146154 if (StringUtils .isNotEmpty (enableDebug ) && enableDebug .equalsIgnoreCase ("true" )) {
147155 return getStartFunctionHostWithDebugCommand ();
148156 } else {
149- return String .format (FUNC_HOST_START_CMD , funcPort );
157+ return String .format (FUNC_HOST_START_CMD , allStartOptions () );
150158 }
151159 }
152160
153161 protected String getStartFunctionHostWithDebugCommand () {
154- return String .format (FUNC_HOST_START_WITH_DEBUG_CMD , funcPort , this .getLocalDebugConfig ());
162+ return String .format (FUNC_HOST_START_WITH_DEBUG_CMD , allStartOptions (), this .getLocalDebugConfig ());
163+ }
164+
165+ // Put together port and other start options
166+ protected String allStartOptions () {
167+ final String startOptionsCli = System .getProperty ("startOptions" );
168+ if (StringUtils .isNotEmpty (startOptionsCli )) {
169+ // override startOptions from maven plugin configuration
170+ startOptions = startOptionsCli ;
171+ }
172+ return " -p " + funcPort + " " + startOptions ;
155173 }
156174
157175 //endregion
0 commit comments