gradle-release icon indicating copy to clipboard operation
gradle-release copied to clipboard

unexpected token in version

Open tristobal opened this issue 6 years ago • 4 comments

Hi there, I run the following command: /gradlew release -Prelease.useAutomaticVersion=true

But throws this error:

:name-service:runBuildTasks FAILED
:release FAILED
Release process failed, reverting back any changes made by Release Plugin.

FAILURE: Build failed with an exception.

* Where:
Build file '/path/to/project/build.gradle' line: 46

* What went wrong:
Could not compile build file '/path/to/project/build.gradle'.
> startup failed:
  build file '/path/to/project/build.gradle': 46: unexpected token: 0 @ line 46, column 15.
     version = 1.0.0
                   ^

And mencioned line is:

version = '1.0.0-SNAPSHOT'

Is it normal this behaviour? Or I got something wrong with my version variable?

tristobal avatar Apr 09 '18 19:04 tristobal

Should work I think and the problem is that the quotes are missing. If you can move it to the gradle.properties and change config it should be fine but build.gradle is supported. Need to check that

Hillkorn avatar Apr 10 '18 19:04 Hillkorn

The quotes are not missing. The log of gradle shows it without them. This is how i have the version in Build.gradle

version = '1.0.0-SNAPSHOT'

Because the nature of my Work I can't touch the gradle.properties.

tristobal avatar Apr 11 '18 19:04 tristobal

me to versionPropertyFile = 'build.gradle'

bootcode1 avatar Jan 25 '19 06:01 bootcode1

Hi all, I have the same issue. In my build.gradle I have:

version = '1.0.3-SNAPSHOT'
release {
  versionPropertyFile = 'build.gradle'
...
}

because I need to generate a jar based on version specified. If during run gradle release I set version with quotes to bypass the problem in final file I find:

version = '1.0.4'-SNAPSHOT

obtaining an artifact with name with the quotes.

Is there any workaroud?

Thanks

fabiogomiero avatar Jul 08 '19 17:07 fabiogomiero