diff --git a/function-maven-plugin/pom.xml b/function-maven-plugin/pom.xml
index 4ddebd00..a7e8764c 100644
--- a/function-maven-plugin/pom.xml
+++ b/function-maven-plugin/pom.xml
@@ -42,11 +42,13 @@
org.apache.maven
maven-plugin-api
3.9.11
+ provided
org.apache.maven
maven-core
3.9.11
+ provided
org.apache.maven.plugin-tools
diff --git a/function-maven-plugin/src/main/java/com/google/cloud/functions/plugin/DeployFunction.java b/function-maven-plugin/src/main/java/com/google/cloud/functions/plugin/DeployFunction.java
index 35dab3f8..d0067ded 100644
--- a/function-maven-plugin/src/main/java/com/google/cloud/functions/plugin/DeployFunction.java
+++ b/function-maven-plugin/src/main/java/com/google/cloud/functions/plugin/DeployFunction.java
@@ -63,9 +63,8 @@ public class DeployFunction extends CloudSdkMojo {
*/
@Parameter(
alias = "deploy.allowunauthenticated",
- property = "function.deploy.allowunauthenticated",
- defaultValue = "false")
- boolean allowUnauthenticated;
+ property = "function.deploy.allowunauthenticated")
+ Boolean allowUnauthenticated;
/**
* Name of a Google Cloud Function (as defined in source code) that will be executed. Defaults to
@@ -314,8 +313,12 @@ public List getCommands() {
if (triggerEvent != null) {
commands.add("--trigger-event=" + triggerEvent);
}
- if (allowUnauthenticated) {
- commands.add("--allow-unauthenticated");
+ if (allowUnauthenticated != null) {
+ if (allowUnauthenticated) {
+ commands.add("--allow-unauthenticated");
+ } else {
+ commands.add("--no-allow-unauthenticated");
+ }
}
if (functionTarget != null) {
commands.add("--entry-point=" + functionTarget);
@@ -371,6 +374,8 @@ public List getCommands() {
if (projectId != null) {
commands.add("--project=" + projectId);
}
+
+ commands.add("--quiet");
return Collections.unmodifiableList(commands);
}
@@ -382,7 +387,9 @@ public void execute() throws MojoExecutionException {
System.out.println("Executing Cloud SDK command: gcloud " + String.join(" ", params));
gcloud.runCommand(params);
} catch (CloudSdkNotFoundException | IOException | ProcessHandlerException ex) {
- Logger.getLogger(DeployFunction.class.getName()).log(Level.SEVERE, null, ex);
+ Logger.getLogger(DeployFunction.class.getName())
+ .log(Level.SEVERE, "Function deployment failed", ex);
+ throw new MojoExecutionException("Function deployment failed", ex);
}
}
}
diff --git a/function-maven-plugin/src/test/java/com/google/cloud/functions/plugin/DeployFunctionTest.java b/function-maven-plugin/src/test/java/com/google/cloud/functions/plugin/DeployFunctionTest.java
index e5a2913d..2b441d4e 100644
--- a/function-maven-plugin/src/test/java/com/google/cloud/functions/plugin/DeployFunctionTest.java
+++ b/function-maven-plugin/src/test/java/com/google/cloud/functions/plugin/DeployFunctionTest.java
@@ -53,7 +53,8 @@ public void testDeployFunctionCommandLine() {
"--env-vars-file=myfile",
"--set-build-env-vars=env1=a,env2=b",
"--build-env-vars-file=myfile2",
- "--runtime=java11");
+ "--runtime=java11",
+ "--quiet");
assertThat(mojo.getCommands()).isEqualTo(expected);
}
}