You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I discovered your plugin from here: https://stackoverflow.com/a/13975553
My goal is very simple, having the git branch name inside the build version.
I also tried to generate the external properties files in order to see if the data is properly gathered from my repo, but no file is created
<!-- this is false by default, forces the plugin to generate the git.properties file -->
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<!-- The path for the properties file to be generated. See Super Pom for default variable reference https://maven.apache.org/guides/introduction/introduction-to-the-pom.html -->
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
Tha main problem here is that I'm not seeing any error, so I'm going a little blind understanding the problem.
By default the plugin doesn't expose the properties into the maven cycle.
However if you set <injectAllReactorProjects>true</injectAllReactorProjects> you should be able to use the properties within your maven-file and for the outlined scenario.
Reacted by IstvΓ‘n FΓΆldhΓ‘zi, Cyrille Chopelet and Raffael Dzikowski
I do not have a parent/child project, the project folder exists only because the repository holds additional files which are not related to Maven itself (like internal logs, schemes, ...)
Here the output
After added the flag you asked, here is part of the generated output
The develop branch is recognized, but I'm having the same problem on the generated property
[INFO] GCLOUD: Temporary staging for module default directory left in D:\Documenti\Java\workspace.noovle\my-project-folder\project\target\appengine-staging
lug 10, 2017 8:14:31 AM com.google.cloud.tools.appengine.cloudsdk.CloudSdk logCommand
INFORMAZIONI: submitting command: C:\Users\Nicola\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\gcloud.cmd app deploy D:\Documenti\Java\workspace.noovle\my-project-folder\project\target\appengine-staging\app.yaml --no-promote --version ${git.branch}-2017-07-10T06:13:15Z --project xxxxx
[INFO] GCLOUD: ERROR: (gcloud.app.deploy) argument --version/-v: Bad value [${git.branch}-2017-07-10T06:13:15Z]: May only contain lowercase letters, digits, and hyphens. Must begin and end with a letter or digit. Must not exceed 63 characters.
```f
Based on the feedback it seems that the plugin itself can retrieve the information....
How do you invoke the GCLOUD (that currently has the error with the bad value)?
Or in other words:
Is this a maven plugin that is getting the parameters through the pom?
Is the a maven plugin that is getting the parameters through a file?
If it is a file i would double check if the file is getting filtered.
If it through the pom I would double check if the properties gets exposed inside the pom.
The <deploy.version>${app.version}</deploy.version> configuration is the one that received the build version, which is a property declared (as reported before) as <app.version>${git.branch}-${maven.build.timestamp}</app.version>
So I can say that the it gets the values from the pom itself. It seems like the property is not well handled
So I tried to use directly the property values inside the configuration
But i'm getting the same error GCLOUD: ERROR: (gcloud.app.deploy) argument --version/-v: Bad value [${git.branch}-2017-07-10]: May only contain lowercase letters, digits, and hyphens
I'm attaching you a sample project with all the plugins configured testgit.zip
In order to use this, I created a simple git repository (only local) and set the HEAD to master (with only 1 commit).
To invoke the gcloud goal you can use "mvn appengine:deploy". The Maven goal will call GCloud SDK, so you need to have it installed in order to reach the point where the error occurs
If everything is configured correctly, you should see this Maven log
lug 11, 2017 8:34:42 AM com.google.cloud.tools.appengine.cloudsdk.CloudSdk logCommand
INFORMAZIONI: submitting command: C:\Users\Nicola\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\gcloud.cmd app deploy --no-promote --version ${git.branch}-2017-07-11 --project my-app-id
[INFO] GCLOUD: ERROR: (gcloud.app.deploy) argument --version/-v: Bad value [${git.branch}-2017-07-11]: May only contain lowercase letters, digits, and hyphens. Must begin and end with a letter or digit. Must not exceed 63 characters.
and executing mvn clean install the values and properties are getting replaced accordingly.
TL;DR,
When calling the Maven-Plugin via the Plugin's Prefix and goal mvn somePrefix:goal it doesn't resolve the variables correctly. When executing the plugin via the normal maven build cycle it is working as expected.
I'll report this to Maven and link as soon as I can remeber my password.
There is nothing i can do to fix this besides changing the way the plugin is being called.
Please refer to #413 (comment) for the difference between the SonarQube issue and this one.
Since there is not much I can do to fix this (as per comment in the maven issue) I only can refer to the available workaround or suggest to open a ticket with the appengine plugin to have some sort of functionality that makes such behaviour possible.
Sadly from the perspective of the plugin I nothing left besides closing this as Can't fix :-(
Activity
TheSnoozer commentedon Jun 30, 2017
By default the plugin doesn't expose the properties into the maven cycle.
However if you set
<injectAllReactorProjects>true</injectAllReactorProjects>you should be able to use the properties within your maven-file and for the outlined scenario.NicolaSpreafico commentedon Jul 7, 2017
Here is my current configuration
with this property
but I'm still having the variable unresolved
TheSnoozer commentedon Jul 8, 2017
Mhh that is somewhat strange.
I tested this with the following:
mvn clean package -Pdemo will result in a jar called
target/master-2017-07-08T14:05:54Z.jarcan you do the following:
<verbose>true</verbose>inside the git-commit-id-plugin config section<failOnNoGitDirectory>true</failOnNoGitDirectory>inside the git-commit-id-plugin config section<failOnUnableToExtractRepoInfo>true</failOnUnableToExtractRepoInfo>inside the git-commit-id-plugin config sectiongit branch -ainside ${project.basedir}/../-Directory?NicolaSpreafico commentedon Jul 10, 2017
Hello,
I do not have a parent/child project, the
projectfolder exists only because the repository holds additional files which are not related to Maven itself (like internal logs, schemes, ...)Here the output

After added the flag you asked, here is part of the generated output
The
developbranch is recognized, but I'm having the same problem on the generated propertyTheSnoozer commentedon Jul 10, 2017
Based on the feedback it seems that the plugin itself can retrieve the information....
How do you invoke the GCLOUD (that currently has the error with the bad value)?
Or in other words:
If it is a file i would double check if the file is getting filtered.
If it through the pom I would double check if the properties gets exposed inside the pom.
Use something like this for debugging purposes:
NicolaSpreafico commentedon Jul 10, 2017
Gcloud is a Maven Plugin which is launched with goal
deployThis is the configuration
The
<deploy.version>${app.version}</deploy.version>configuration is the one that received the build version, which is a property declared (as reported before) as<app.version>${git.branch}-${maven.build.timestamp}</app.version>So I can say that the it gets the values from the pom itself. It seems like the property is not well handled
So I tried to use directly the property values inside the configuration
But i'm getting the same error
GCLOUD: ERROR: (gcloud.app.deploy) argument --version/-v: Bad value [${git.branch}-2017-07-10]: May only contain lowercase letters, digits, and hyphensTheSnoozer commentedon Jul 10, 2017
can you provide an example project where i can reproduce this?
What is the output of
NicolaSpreafico commentedon Jul 11, 2017
I'm attaching you a sample project with all the plugins configured
testgit.zip
In order to use this, I created a simple git repository (only local) and set the HEAD to master (with only 1 commit).
To invoke the gcloud goal you can use "
mvn appengine:deploy". The Maven goal will call GCloud SDK, so you need to have it installed in order to reach the point where the error occursIf everything is configured correctly, you should see this Maven log
The output of the antrun-plugin is
TheSnoozer commentedon Jul 13, 2017
Well this is somewhat really strange....Currently I can reproduce the problem but don't understand what it is caused by....
I thought it might be a Maven internal Problem where the @Parameter-Annotation is broken again and created a sample Maven-Project that uses the same stuff as the app-engine (https://github.com/GoogleCloudPlatform/app-maven-plugin/blob/master/pom.xml)
Just for future reference can be executed by:
mvn clean install && mvn clean package -PdemoDownload project here:
SampleMavenProject.zip
I'll update once I have something more concrete....
TheSnoozer commentedon Jul 13, 2017
Ok just as a follow up....I cloned the app-maven-plugin from git and introduced some debugging code to verify what is going on....
The Mojo-Class that is being used for
mvn appengine:deployand taking the version argument can be found here:https://github.com/GoogleCloudPlatform/app-maven-plugin/blob/master/src/main/java/com/google/cloud/tools/maven/DeployMojo.java
In https://github.com/GoogleCloudPlatform/app-maven-plugin/blob/master/src/main/java/com/google/cloud/tools/maven/DeployMojo.java#L142 we have the getter-method that retrieves the parameter:
So far this is pretty much default stuff.
Now the interesting observation....when using the suggested command it doesn't seem to replace the Maven-project properties no matter what.
However when changing the plugin-Definition inside the pom.xml to the following:
and executing
mvn clean installthe values and properties are getting replaced accordingly.TL;DR,
When calling the Maven-Plugin via the Plugin's Prefix and goal
mvn somePrefix:goalit doesn't resolve the variables correctly. When executing the plugin via thenormal maven build cycleit is working as expected.I'll report this to Maven and link as soon as I can remeber my password.
There is nothing i can do to fix this besides changing the way the plugin is being called.
TheSnoozer commentedon Jul 13, 2017
Maven Sample project to reproduce the issue:
SampleProjectV2.zip
mvn clean install && mvn clean package-> workingmvn clean install && mvn com.test.plugins:testPlugin:deployMojo-> brokenmvn clean install && mvn com.test.plugins:testPlugin:buildInjectPropertyMojo antrun:run com.test.plugins:testPlugin:deployMojo-> workingMaven Bug Report:
https://issues.apache.org/jira/browse/MNG-6260
20 remaining items
NicolaSpreafico commentedon Apr 26, 2019
Thank you,
so, just to be sure, at the moment there is no workaround for having the git.branch name inside SonarQube version?
TheSnoozer commentedon Apr 30, 2019
Please refer to #413 (comment) for the difference between the SonarQube issue and this one.
Since there is not much I can do to fix this (as per comment in the maven issue) I only can refer to the available workaround or suggest to open a ticket with the appengine plugin to have some sort of functionality that makes such behaviour possible.
Sadly from the perspective of the plugin I nothing left besides closing this as
Can't fix:-(deps: Update dependency io.github.git-commit-id:git-commit-id-maven-pβ¦
deps: Update dependency io.github.git-commit-id:git-commit-id-maven-pβ¦
deps: Update dependency io.github.git-commit-id:git-commit-id-maven-pβ¦
deps: Update dependency io.github.git-commit-id:git-commit-id-maven-pβ¦
deps: Update dependency io.github.git-commit-id:git-commit-id-maven-pβ¦
deps: Update dependency io.github.git-commit-id:git-commit-id-maven-pβ¦
deps: Update dependency io.github.git-commit-id:git-commit-id-maven-pβ¦
deps: Update dependency io.github.git-commit-id:git-commit-id-maven-pβ¦
Update dependency io.github.git-commit-id:git-commit-id-maven-plugin β¦