Difference between gradle upload and gradle publish - gradle

I am testing pushing my artifacts to a Nexus maven repository. I am using gradle to do so.
What is the difference between gradle upload and gradle publish?

Currently gradle provides two publishing mechanisms. Original - shipped with java plugin - is described here and is based on a task of type Upload. This mechanism is going to be replaced by the - currently incubating - second mechanism that is separated from java plugin and also splitted into maven and ivy. This new mechanism is described here.

Also have a look at "Upgrading your build from Gradle 6.x to the latest": "Removal of the uploadArchives task: The uploadArchives task was used in combination with the legacy Ivy or Maven publishing mechanisms. It has been removed in Gradle 7. You should migrate to the maven-publish or ivy-publish plugin instead."

Related

can you build a maven project inside of a gradle wrapper

It may be just that I have a general misunderstanding how gradle build works, but it feels to me that I can not build a maven file inside of a gradle build. Since gradle uses the gradle.build file, and maven uses a pom.xml, it does not seem as though I can do this. I have multiple maven projects that I would like to wrap up with a gradle wrapper. I can not find ANYTHING on whether this is even possible.
Both Maven and Gradle are build tools and you should only use one of them for a given project.
If you have existing Maven projects and like the functionality provided by the Gradle wrapper, there is a similar wrapper for Maven (note that this is currently a third-party plugin but they plan to include it in the upcoming release 3.7 of Maven).
Alternatively you could convert your projects entirely to Gradle.

Is it possible to override existing resource on Nexus when publishing its newer version using Gradle?

I had a very simple Gradle script to publish a library to Nexus using Gradle Maven Publish plugin. I got the following error when I reran the task :
Could not write to resource 'some_resource.pom'
I can delete it manually from the Nexus UI but I am wondering if there is a more programmatic way to do it. Btw, I do have write access to Nexus.

How to use golang build commands in gradle

I am trying to write buildscript in gradle for a simple golang web application.
Can someone please tell me how to use golang commands for build and install in gradle build?
I do not see any clear documentation for the usage of gradle for a go lang application.
Try Gogradle https://github.com/blindpirate/gogradle, a full-featured Golang build plugin.
What you need to do is creating a build.gradle as documented, and run ./gradlew build or ./gradlew test.
gradle supports maven plugins and you can just call the mvn-golang maven plugin as usual maven plugin published in the maven central

What is the difference between gradle install and gradle publishToMavenLocal?

In gradle, the install task is introduced by the maven plugin.
The publishToMavenLocal task is introduced by the maven-publish plugin.
The documentation of both tasks says they install/publish the module/artifacts to the local maven cache (.m2 directory).
If I need to publish a local project to my local maven cache, so that another local project can depend on it, which of the two tasks should I use?
As far as I know, these two accomplish the same thing.
That said, I recommend using the maven-publish plugin because:
It's newer and has a nicer publishing DSL, see the Maven Publish Plugin page for more details
It doesn't explicitly depend on the java plugin, which is useful if you ever build non-Java projects
You can always write: task install(dependsOn: 'publishToMavenLocal') if you like the task name install.

how to build playorm JARs

I am new to playorm and gradle. My goal is to get playorm compiled (especially play 2.1 plugin) and deployed to local nexus repository manager.
What gradle tasks should I invoke to do this?
I tried to run gradlew clean assemble - creates workspace*.jar in output/libs so I assume build part was done. How to get these artefacts renamed and uploaded to my nexus?
https://github.com/deanhiller/playorm
You'll want to read this chapter of the user guide. It looks like the only repository configured for playorm is Maven Central, but the user guide tells you how to configure your own repository and interact with it. After following the guide, if you have a more specific question ask again here.
I created local.gradle and included it in build.gradle to create uploadArchives task using standard gradle upload procedure.
build.gradle was modified in upstream version to include local.gradle if exists.

Resources