Publish HTML Javadoc with Gradle - gradle

We are publishing Javadoc as a jar through a Maven publish task, but I would like to know now if there is an easy way to upload the HTML directory of the Javadoc (and maybe other pages like Swagger documentation) to a raw Nexus repository?
I've seen I can call curl and scp through Groovy, but I'd rather use a Gradle task if it's possible. I've tried with an Upload task but did not succeed to add a whole directory as artefact in a configuration. I have also looked at dashboards but it is not included.

Related

How to Publish JSP Tag files using Gradle to Nexus Raw type repository

We use Gradle for for our builds. After our CI, we publish our Jar artifacts to our Nexus Maven Repo which other Internal teams can access and use.
We have a problem now wherein one of our Internal teams who does not have access to codebase requires the Jsp tag files and TLD files in a shared repo to compile their custom JSPs.
To achieve this, I have created a "raw" repository in our Nexus with a plan to publish/upload the required tag files using a Gradle task which the Other team can download to their workspace from the same repo using another Gradle task which downloads them.
I got stuck on how to publish/upload all the JSP tag files available in one particular folder to Nexus Raw repo from Gradle
Any help is highly appreciated.!

How to download all available artifacts from a specific repository url in build.gradle

I'm working on a multi-module build which is needed to create an artifact from all WSDLs available on an internal repository. But they are a lot and I don't want to make a list of it, because it might be possible that later another WSDL project is created and needs to be included in the list, if that doesn't happen then the final artifact will be incomplete.
So I need to know if there's any way I can tell gradle to fetch artifacts present on a certain path like domain.com/path/to/repo/wsdls/ and fetch all available artifacts from this path.
I was thinking of creating a configuration which then has this specific repository to download from but it seems configuration does not include a repository and will use defined in build.gradle.
Any way to define a download-everything-pattern in dependencies block?
EDIT: Note: WSDL project means soap services in a zip archive

List the remote repositories used in gradle project by parsing build.gradle from a maven project

How can I list the remote repositories used in gradle project by parsing build.gradle from a maven project.Using aether for a maven project I was able to get the dependencies looking for something similar to aether that can be used on gradle projects to get the dependencies, remote repositories used in the project.
build.gradle is not really parsed, but interpreted, because each Gradle script is a Groovy script. Of course you could try to parse the repositories or the dependencies closure, but you could never be sure, that other parts of the script or even other scripts like initialization scripts add repositories or dependencies behind your back.
I would recommend to write tasks that collect the repositories or dependencies and write them in a parseable format / notation like CSV, JSON or XML. If you need to reuse the functionality, you could even wrap these tasks in a plugin.
To iterate over repositories, I can refer to this similar question.
For dependencies, you have two possibilities: Either write a task on your own, like for the repositories, or use the existing type DependencyReportTask and its outputFile property. Then you would have to find a way to parse the report format.

Artifactory maven-metadata.xml and bundles with Java API

I'm attempting to upload & deploy a jar that we receive from a vendor into Artifactory using the Java API (artifactory-java-client-services v1.1.0). My uploads don't generate maven-metadata.xml and I can't find an option to auto-generate a pom.xml. I also can't find how I would indicate that I'm uploading a bundle rather than a single file.
Currently I'm using a simple snippet of code to upload a test jar and a simple pom:
Path jarPath = Paths.get(tmpDir.toString(), "test1.jar");
RepositoryHandle repositoryHandle =
ArtifactoryClient.create(url, username, password).repository(repositoryName);
UploadableArtifact jarArtifact =
repositoryHandle.upload("com/company/play/1.0.0/test.jar", jarPath.toFile());
File responseFile = jarArtifact.upload();
I use the same process to upload the pom.xml.
So:
Is there a way to request the maven-metadata.xml be recalculated as in the REST call shown here?
Is there any way to indicate that Artifactory needs to auto-generate a simple pom.xml on upload with the Java API?
Is there any way to indicate that the upload is a bundle?
Thanks in advance!
maven-metadata.xml is generated automatically upon deployment. Note that it might take some time – indexing and metadata generation is an async task.
pom.xml generation is not triggered from REST API or Java API ATM. Didn't you mention that you upload the pom.xml?
Not sure what you mean by "bundle". OSGi bundle? Or an archive that you expect Artifactory to unzip and deploy? In case of OSGi bundle there is nothing needed to be done, in case of the archive, again, it's not supported ATM.

Library to create and upload jar dynamically to maven repository

I have service based environment in which I have to create a jar and upload it dynamically to maven repository and return the dependency tree for it. Is there any library which will create a jar file and upload that jar file to maven repository and will return me dependecny of uploaded jar. Right now Im creating it with maven goals in eclipse but I don't want that.
Thanks,
If you don't want to use the command line or IDE, have you looked at the Maven API? There's also an 'undocumented' Maven embedder project.
Below are some links that may help you get started, pick the approach that is easier for you, while meeting your requirements:
https://github.com/jenkinsci/lib-jenkins-maven-embedder/blob/master/src/main/java/hudson/maven/MavenEmbedder.java
http://maven.apache.org/ref/3.0.2/maven-embedder/apidocs/org/apache/maven/cli/MavenCli.html
http://q4e.googlecode.com/svn-history/r819/trunk/plugins/maven/core/src/org/devzuz/q/maven/embedder/internal/EclipseMaven.java
http://developers-blog.org/blog/def../2009/09/18/How-to-resolve-an-artifact-with-maven-embedder

Resources