Help with gradle builds

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with gradle builds

lukestephenon
A while back I forked some of the glu / utils projects to make some for the windows agent.  We have found the windows agent to be stable, and are looking to release it.

Currently I've just been managing the built SNAPSHOT artifacts manually, because I couldn't get my head around how the gradle publish can be configured, even though its appears well defined https://github.com/pongasoft/gradle-plugins#34-orglinkedinrelease

Now that we are looking to create our first release version of the agent (with windows modifications), I have to sort this out.

I'm trying to publish to an internal nexus instance.

I first run 'gradlew assemble' to build the project.  After that I run 'gradlew publish' to upload the snapshot to nexus.

This fails with:
* What went wrong:
Execution failed for task ':org.linkedin.zookeeper-cli:uploadPublishMaster'.
> Cannot locate previously built artifact [C:\Dev\workspace\utils-zookeeper\out\build\org.linkedin.zookeeper-cli\distributions\org.linkedin.zookeeper-cli-2.0.3-SNAPSHOT.tgz]

That file exists, so I thought it was potentially a windows related issue.  But on linux I get the same issue as well.  The built path is correct and present on disk.
> Cannot locate previously built artifact [/local/dev/projects/utils-zookeeper/out/build/org.linkedin.zookeeper-
cli/distributions/org.linkedin.zookeeper-cli-2.0.3-SNAPSHOT.tgz]

I'm completely new to gradle, so I've probably messed something up, but any ideas why it's failing to find the locally built artiact?

Thanks

Reply | Threaded
Open this post in threaded view
|

Re: Help with gradle builds

frenchyan
Administrator
I can tell you that this is what I do (but cannot remember if it was the same in 4.7.2):

./gradlew -Prelease=true clean test release

=> -Prelease=true gets rid of the -SNAPSHOT and build with the version number without it

release is supposed to release ONLY in a local directory which is defined there: https://github.com/pongasoft/glu/blob/master/repositories.gradle#L18 (by default under release)

then I take the tar file generated, run my sanity check and if everything is fine, I then issue

./gradlew -Prelease=true publish

At this stage publish does NOT build anything. It simply publishes the artifacts that are built during the release phase (and which were tested). In the "default" setting it publishes to jcenter but that is also changeable in the repositories.gradle file.

Note that you can run any of those commands from any level (ex: under agent only) but then you need to properly reference gradlew (ex: ../gradlew).

Again this is how I am doing it on the main branch. I do not remember how it was under 4.7.2 but probably very similar (except that I think publish was publishing into a local publish maven folder).

Hope this helps.

Yan
Reply | Threaded
Open this post in threaded view
|

Re: Help with gradle builds

lukestephenon
I'm not trying to release 4.7.2 of the agent.  When I get to the agent, I'll make sure I've got all the latest changes, so I'll be releasing 5.5.1-patch.

At this point I'm trying to deploy some changes of https://github.com/pongasoft/utils-zookeeper that I've made.  I'm just looking to upload a SNAPSHOT build initially to nexus so the changes can be incorporated into other builds.  Shortly after I'll release (but for now I'm just focused on the SNAPSHOT publishing to nexus).

Once we've tested internally I'll send a pull request your way.  The projects I'll need to publish are utils-zookeeper, utils-misc and glu

Do the builds support publishing a SNAPSHOT to nexus? Is that also the release task?
release - Releases in a releaseRepo [snapshotRelease]

So on utils-zookeeper I've run
gradlew clean test release
This works fine.

Then I run
gradlew publish
Could not load previous build info
groovy.json.JsonException: Expected a value on line: 101, column: 2.
But got an unterminated object.
.... (stack trace) ....
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':org.linkedin.zookeeper-cli:uploadPublishMaster'.
> Cannot locate previously built artifact [C:\Dev\workspace\utils-zookeeper\out\build\org.linkedin.zookeeper-cli\distributions\org.linkedin.zookeeper-cli-2.0.3-SNAPSHOT.tgz]

The stack trace doesn't show what file has the invalid json.  I can't find any json files in the project.

Anyway the same command on linux works, so I'll start using that for my builds.  Now the build on linux is publishing to "to repository remote at file://localhost" so I just need to configure that and I should be sorted.

Thanks

Luke