I have a multi-module project, and I’m using maven-publish to publish the jar, javadoc jar and source jar for each module to our local Nexus repo. This works fine if all I want to do is:
gradle clean build publish
In this case, all my modules build and all the relevant artifacts are uploaded to the repo. So far, so good. What I’m trying to do, though, is use the gradle-git plugin to perform a release (and ultimately to upload the released artifacts to the repo). I’ve added the gradle-git plugin to my build, and it works fine, in the sense that I can run
gradle clean build releasePatchVersionAsDev
and it will happily figure out the correct version number (which it dumps to the console), build the code, and push all my unpushed changes.
However, what I really want is for the release plugin to upload all the artifacts with the newly-derived version number. Which it apparently supports via a set of releaseTasks:
releaseTasks = [ 'publish' ]
I then run:
gradle clean build releasePatchVersionAsDev
and everything seems to work as expected (it cleans, builds, correctly figures out a version number for the release and prints it to the console), and then it hits the publish task and simply prints:
:publish UP-TO-DATE
Obviously this isn’t what I want. Publish needs to upload the artifacts to the repo, just as it does if I run it explicitly. For some reason when the release task depends on the publish task, it doesn’t seem to see the publications.
Running the release task with debug enabled, this is what it does when it hits the publish task:
10:10:21.262 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ':publish'
10:10:21.263 [INFO] [org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter] Skipping task ':publish' as it has no actions.
10:10:21.263 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':publish'
10:10:21.263 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :publish UP-TO-DATE
10:10:21.263 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :publish (Thread[main,5,main]) completed. Took 0.001 secs.
10:10:21.263 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :validateSinceTags (Thread[main,5,main]) started.