GoogleCloudPlatform / gcloud-maven-plugin

Cloud SDK Maven Plugin for Google App Engine (Managed VMs and non Managed VMs)
Apache License 2.0
29 stars 24 forks source link

${gcloud.plugin.version} cannot be resolved #106

Open codedread opened 7 years ago

codedread commented 7 years ago

I'm trying to follow https://cloud.google.com/appengine/docs/java/tools/maven to create a new App Engine skeleton project in my Google Cloud Shell.

1) Java and Maven configuration information from gcloud shell:

$ mvn -v Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00) Maven home: /apache-maven-3.3.9 Java version: 1.7.0_111, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.16.0-4-amd64", arch: "amd64", family: "unix"

2) Running the following command:

$ mvn archetype:generate -Dappengine-version=1.9.48 -Dmyappid= -Dfilter=com.google.appengine.archetypes:appengine-skeleton-archetype

3) I get the following prompt:

[INFO] Scanning for projects... [INFO]
[INFO] ------------------------------------------------------------------------ [INFO] Building Maven Stub Project (No POM) 1 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources @ standalone-pom >>> [INFO] [INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-sources @ standalone-pom <<< [INFO] [INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom --- [INFO] Generating project in Interactive mode [INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0) Choose archetype: 1: remote -> com.google.appengine.archetypes:appengine-skeleton-archetype (A skeleton application with Google App Engine) Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains):

where I choose 1. (FWIW, Why does it ask me this when I've specified it on the command line via -Dfilter) ?

4) It then asks me the App Engine version:

Choose com.google.appengine.archetypes:appengine-skeleton-archetype version: 1: 1.8.7 2: 2.0.0-1.9.10 3: 2.0.1-1.9.20 4: 2.0.2-1.9.21 5: 2.0.2-1.9.25 6: 2.1.0-1.9.38

I have no idea what to choose here (didn't I specify that in -Dappengine-version?) since 1.9.48 is not listed here. I choose 6 (the default).

5) I then enter a few random strings and accept some random defaults :)

Define value for property 'groupId': : com.foo.bar Define value for property 'artifactId': : myappid Define value for property 'version': 1.0-SNAPSHOT: : Define value for property 'package': com.foo.bar: : [INFO] Using property: appengine-version = 1.9.48 [INFO] Using property: application-id = myappid Dec 21, 2016 12:03:07 PM org.apache.velocity.runtime.log.JdkLogChute log INFO: FileResourceLoader : adding path '.' Dec 21, 2016 12:03:07 PM org.apache.velocity.runtime.log.JdkLogChute log INFO: Null reference [template 'gcloud-version', line 1, column 1] : ${gcloud.plugin.version} cannot be resolved. Define value for property 'gcloud-version': ${gcloud.plugin.version}: :

At this point it's complaining that the gcloud.plugin.version cannot be resolved. Selecting the default seems like it's a broken thing to do.

6) In a different gcloud shell, I tried this:

$ gcloud --version Google Cloud SDK 137.0.1 alpha 2016.01.12 app-engine-go app-engine-go-linux-x86_64 1.9.48 app-engine-java 1.9.46 app-engine-php " " app-engine-python 1.9.40 beta 2016.01.12 bq 2.0.24 bq-nix 2.0.24 cloud-datastore-emulator 1.2.1 core 2016.12.08 core-nix 2016.11.07 gcd-emulator v1beta3-1.0.0 gcloud gsutil 4.22 gsutil-nix 4.18 kubectl kubectl-linux-x86_64 1.4.6 pubsub-emulator 2016.08.19

Based on the above, I am not really sure what I should put into the interactive prompt

7) FWIW, I accepted the defaults and it said:

Confirm properties configuration: groupId: com.foo.bar artifactId: myappid version: 1.0-SNAPSHOT package: com.foo.bar appengine-version: 1.9.48 application-id: myappid gcloud-version: ${gcloud.plugin.version} Y: : y [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating project from Archetype: appengine-skeleton-archetype:2.1.0-1.9.38 [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: groupId, Value: com.foo.bar [INFO] Parameter: artifactId, Value: myappid [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] Parameter: package, Value: com.foo.bar [INFO] Parameter: packageInPathFormat, Value: com/foo/bar Dec 21, 2016 12:15:33 PM org.apache.velocity.runtime.log.JdkLogChute log INFO: Null reference [template 'gcloud-version', line 1, column 1] : ${gcloud.plugin.version} cannot be resolved. [INFO] Parameter: gcloud-version, Value: ${gcloud.plugin.version} [INFO] Parameter: package, Value: com.foo.bar [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] Parameter: groupId, Value: com.foo.bar [INFO] Parameter: appengine-version, Value: 1.9.48 [INFO] Parameter: application-id, Value: myappid [INFO] Parameter: artifactId, Value: myappid [INFO] project created from Archetype in dir: ... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 15:37 min [INFO] Finished at: 2016-12-21T12:15:33-08:00 [INFO] Final Memory: 15M/48M [INFO] ------------------------------------------------------------------------

8) I then went into the directory it created and continued to try and follow the tutorial:

$ mvn clean install [INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [ERROR] Resolving expression: '${gcloud.plugin.version}': Detected the following recursive expression cycle in 'gcloud.plugin.version': [gcloud.plugin.version] @ [ERROR] Resolving expression: '${gcloud.plugin.version}': Detected the following recursive expression cycle in 'gcloud.plugin.version': [gcloud.plugin.version] @ [ERROR] 'build.plugins.plugin.version' for com.google.appengine:gcloud-maven-plugin must be a valid version but is '${gcloud.plugin.version}'. @ line 118, column 24 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR]
[ERROR] The project ...:1.0-SNAPSHOT (.../pom.xml) has 3 errors [ERROR] Resolving expression: '${gcloud.plugin.version}': Detected the following recursive expression cycle in 'gcloud.plugin.version': [gcloud.plugin.version] -> [Help 2] [ERROR] Resolving expression: '${gcloud.plugin.version}': Detected the following recursive expression cycle in 'gcloud.plugin.version': [gcloud.plugin.version] -> [Help 2] [ERROR] 'build.plugins.plugin.version' for com.google.appengine:gcloud-maven-plugin must be a valid version but is '${gcloud.plugin.version}'. @ line 118, column 24 [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/InterpolationCycleException

njtromp commented 7 years ago

I encountered the same issue. Choosing option number 5: 2.0.2-1.9.25' solved the issue. This version is also reported as a valid option on https://cloud.google.com/appengine/docs/java/tools/maven.

Hope this helps.