Closed varora1975 closed 7 years ago
It looks like some task tries (docker maybe?) to serialize its task inputs (or something to that effect), and project.version
appears to be one of those inputs. Unfortunately the version object from the plugin is not serializable. I'm not sure why a task would be trying to do that - you certainly can't assume that the version will always be serializable if it is Object
. One way around it would be to set the version property in that task explicitly to project.version.toString()
. But this will cause another problem. Since the versioning plugin uses tasks to control the version number, the actual version number is only available after the configuration phase. This means that the version property will get the wrong version. To get around that, you can set the version property explicitly inside a taskGraph.whenReady
block.
A newer version of this plugin is in the works and will aim to address this "delayed configuration" issue.
I tried removing docker tasks and added below snippet in my build.gradle. But still getting same error
gradle.taskGraph.whenReady {taskGraph -> version = "1.0.0" }
From the stack trace I can't really tell what it could be. I would suggest disabling plugins one by one and also possibly clearing out the cache?
I tried disabling all the plugins not no luck. Just wanted to let you know that when I run
gradlew printVersion
Output is
_version_1.0.1-SNAPSHOT:printVersion 1.0.0
BUILD SUCCESSFUL
But while running
gradlew clean jar
It prints project.version property as _version_1.0.1-SNAPSHOT:clean and fails with same error
If you can provide any suggestion will be helpful
During which task does it fail? Also, did you clear out your gradle cache?
When I run gradlew jar --stacktrace task it fails and gradlew printVersion or gradlew clean is successful.
I deleted my .gradle folder but still same error
So even after deleting ~/.gradle
you run into the same error? From researching, this looks to be an issue with the gradle cache and unrelated to the plugin. If this continues, I suggest asking for help on the gradle forum - they will probably be able to help you out better.
Hi ,
I am trying to use version plugin and getting error when using following command
gradlew clean jar bumpMinor --stacktrace
gradlew clean jar autobump --stacktrace
I am getting below error
Exception is: org.gradle.api.UncheckedIOException: Could not add entry ':buildProperties' to cache taskArtifacts.bin (.gradle\2.9\taskArtifacts\taskArtifacts.bin). at org.gradle.cache.internal.btree.BTreePersistentIndexedCache.put(BTreePersistentIndexedCache.java:155) at org.gradle.cache.internal.DefaultMultiProcessSafePersistentIndexedCache$2.run(DefaultMultiProcessSafePersistentIndexedCache.java:51) at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.doWriteAction(DefaultFileLockManager.java:173) at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.writeFile(DefaultFileLockManager.java:163) at org.gradle.cache.internal.DefaultCacheAccess$UnitOfWorkFileAccess.writeFile(DefaultCacheAccess.java:404) at org.gradle.cache.internal.DefaultMultiProcessSafePersistentIndexedCache.put(DefaultMultiProcessSafePersistentIndexedCache.java:49) at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$1$1.run(CacheBackedTaskHistoryRepository.java:91) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:192) at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175) at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106) at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187) at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:60) at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$1.update(CacheBackedTaskHistoryRepository.java:66) at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.afterTask(DefaultTaskArtifactStateRepository.java:124) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:66) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151) at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82) at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94) at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:77) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:47) at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51) at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28) at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43) at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) at org.gradle.launcher.Main.doAction(Main.java:33) at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54) at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35) at org.gradle.launcher.GradleMain.main(GradleMain.java:23) at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61) Caused by: org.gradle.api.GradleException: Unable to store task input properties. Property 'info.app.version' with value '1.0.1-SNAPSHOT' cannot be serialized. at org.gradle.api.internal.changedetection.state.InputPropertiesSerializer.write(InputPropertiesSerializer.java:42) at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$LazyTaskExecution$TaskHistorySerializer.write(CacheBackedTaskHistoryRepository.java:310) at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$TaskHistorySerializer.write(CacheBackedTaskHistoryRepository.java:171) at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$TaskHistorySerializer.write(CacheBackedTaskHistoryRepository.java:146) at org.gradle.cache.internal.btree.BTreePersistentIndexedCache$DataBlock.setValue(BTreePersistentIndexedCache.java:654) at org.gradle.cache.internal.btree.BTreePersistentIndexedCache$DataBlock.(BTreePersistentIndexedCache.java:647)
at org.gradle.cache.internal.btree.BTreePersistentIndexedCache.put(BTreePersistentIndexedCache.java:149)
... 72 more
Caused by: org.gradle.internal.serialize.MapSerializer$EntrySerializationException: Unable to write entry with key: 'info.app.version' and value: '1.0.1-SNAPSHOT'.
at org.gradle.internal.serialize.MapSerializer.write(MapSerializer.java:50)
at org.gradle.api.internal.changedetection.state.InputPropertiesSerializer.write(InputPropertiesSerializer.java:40)
... 78 more
Caused by: java.io.NotSerializableException: net.vivin.gradle.versioning.SemanticBuildVersion
at org.gradle.internal.serialize.DefaultSerializer.write(DefaultSerializer.java:53)
at org.gradle.internal.serialize.MapSerializer.write(MapSerializer.java:48)
... 79 more
My Git Tags are git tag 1.0.0
build.gradle
buildscript { ext { grailsVersion = project.grailsVersion } repositories { mavenLocal() // maven { url "https://repo.grails.org/grails/core" }
}
plugins { id "net.vivin.gradle-semantic-build-versioning" version "2.0.2" }
plugins { id "org.sonarqube" version "2.2" }
group "propertyservice"
apply plugin:"eclipse" apply plugin:"idea"
// Disable war plugin to create a jar file otherwise a fully executable war file is created. apply plugin:"war"
apply plugin:"org.grails.grails-web" apply plugin:"org.grails.grails-gsp" apply plugin:"asset-pipeline" apply plugin: 'docker' // apply plugin:"codenarc" apply plugin: "jacoco" apply plugin: "org.sonarqube" apply plugin: 'net.vivin.gradle-semantic-build-versioning' project.version.with { startingVersion = '1.0.0' }
ext { grailsVersion = project.grailsVersion gradleWrapperVersion = project.gradleWrapperVersion grails { pathingJar = true } }
/*
dependencies { compile "org.grails.plugins:aws-sdk:1.10.44" }
repositories { mavenLocal()
}
dependencyManagement { imports { mavenBom "org.grails:grails-bom:$grailsVersion" } applyMavenExclusions false }
dependencies { compile "org.springframework.boot:spring-boot-starter-logging" compile "org.springframework.boot:spring-boot-autoconfigure" compile "org.grails:grails-core" compile "org.springframework.boot:spring-boot-starter-actuator" compile "org.springframework.boot:spring-boot-starter-tomcat" compile "org.grails:grails-dependencies" compile "org.grails:grails-web-boot" compile "org.grails.plugins:cache" compile "org.grails.plugins:scaffolding" compile "org.grails.plugins:hibernate4" compile "org.hibernate:hibernate-ehcache" compile "org.grails:grails-datastore-rest-client:5.0.5.RELEASE" compile "org.grails.plugins:elasticsearch:1.0.0.2" // compile "org.grails.plugins:aws-sdk:1.10.44" compile "org.grails.plugins:quartz:2.0.1" compile 'com.auth0:auth0-spring-mvc:0.0.1' compile group: 'javax.servlet', name: 'jstl', version: '1.2' compile'org.codehaus.groovy.modules.http-builder:http-builder:0.5.0'
}
task wrapper(type: Wrapper) { gradleVersion = gradleWrapperVersion }
assets { minifyJs = false minifyCss = false }
grails { agent { enabled = false } // Pathing Jar fixes the file length exceeding command line character limit issue in Windows pathingJar = true }
test { forkEvery 1 ignoreFailures = true }
docker { maintainer 'Tenzing "tenzing@tenzing.co.nz"' }
task docker(type: Docker, dependsOn: build) { // push = true // applicationName = jar.baseName applicationName = "property-service" // tagVersion = "1.0" dockerfile = file('src/main/docker/Dockerfile') doFirst { copy { from war into stageDir } } }