regex - build-helper-maven-plugin: unable to use replaced value with other plugins -


i have google app engine standard maven project, created appengine-standard-archetype archetype.

i want use ${project.version} variable deploy version, value not allowed characters:

may contain lowercase letters, digits, , hyphens. must begin , end letter or digit. must not exceed 63 characters.

the value 0.0.1-snapshot need modified. used build-helper-maven-plugin obtain replacement

<plugin>     <groupid>org.codehaus.mojo</groupid>     <artifactid>build-helper-maven-plugin</artifactid>     <version>3.0.0</version>     <executions>         <execution>             <id>version-urlsafe</id>             <goals>                 <goal>regex-property</goal>             </goals>             <configuration>                 <name>project.version.urlsafe</name>                 <value>${project.version}</value>                 <regex>\.</regex>                 <replacement>-</replacement>                 <tolowercase>true</tolowercase>                 <failifnomatch>false</failifnomatch>             </configuration>         </execution>     </executions> </plugin> 

and maven-antrun-plugin show value

<plugin>     <artifactid>maven-antrun-plugin</artifactid>     <version>1.8</version>     <executions>         <execution>             <id>regex-replace-echo</id>             <phase>package</phase>             <goals>                 <goal>run</goal>             </goals>             <configuration>                 <tasks>                     <echo>******** displaying value of property ********</echo>                     <echo>${project.version.urlsafe}</echo>                 </tasks>             </configuration>         </execution>     </executions> </plugin> 

at end used new property version deploy

<app.deploy.version>${project.version.urlsafe}-urlsafe</app.deploy.version> 

note add -urlsafe @ end of value understand why value not considered

running deploy mvn appengine:deploy i'm getting output

...  [info] executing tasks  main:      [echo] ******** displaying value of property ********      [echo] 0-0-1-snapshot  ...  gcloud.cmd app deploy --version ${project.version.urlsafe}-urlsafe [info] gcloud: error: (gcloud.app.deploy) argument --version/-v: bad value [${project.version.urlsafe}-urlsafe] 

even if ant-run plugin echoed new version, when deploy command built, variable missing.

i tried forcing regex-property goal before deploy, follows

mvn build-helper:regex-property appengine:deploy 

but i'm getting missing configuration error in case:

[error] failed execute goal org.codehaus.mojo:build-helper-maven-plugin:3.0.0:regex-property (default-cli) on project maventest: parameters 'regex', 'name', 'value' goal org.codehaus.mojo:build-helper-maven-plugin:3.0.0:regex-property missing or invalid -> [help 1] 

a little digression: decided manually run build-helper:regex-property additional goal due previous experience similar case: plugin inject new variable, echoed when comes use value, missing. here reference: unable obtaing git.branch property

cooperating plugin author found adding plugin goal before appengine 1 can solve issue mvn git-commit-id:revision appengine:deploy. @ end root cause of problem maven bug: https://issues.apache.org/jira/browse/mng-6260

so workaround of directly calling plugin not suitable in case due plugin configuration error.

how can issue can solved? how can obtain ${project.version.urlsafe} variable created when executing appengine deploy?


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -